Types that you wish were in Elixir

We can probably get syntactic sugar for string-keyed and atom-keyed maps? Technically these:

%{String.t() => term()} 
%{atom() => term()} 

…should be enough, but I do wonder whether having builtin syntax won’t help further adoption. Something like e.g. string_map() and atom_map().

Maybe some imitation of sum types as well? So instead of this:

@type pixel_value :: :red | :blue | :green

…we can have this:

@type pixel_value :: Enum(red | blue | green)

That would be just some syntactic sugar.

But I don’t think the community will agree on alternative syntaxes for things you already can express. I am mostly thinking out loud here.

1 Like