4 ms·
The lack of introspection for union types during compile time has created some frustration for me as well. Not having some kind of compile time union list avail
by justusw 10y ago
The lack of introspection for union types during compile time has created some frustration for me as well. Not having some kind of compile time union list available sucks (it would probably be possible using some LISP-esque macro system), but I will gladly accept it, given the runtime safety.
I would like to encourage the author to revisit the 'timeRangeFromString' function and consider wrapping the result in a Maybe or Result, as this is exactly the type of function that is not guaranteed to deliver a result. With strongly typed languages like Elm it is best to use the type system to one's advantage, and not fight against it.
That is not to say that everyone should like Elm or similar languages, but they require you to shift the way you think about how you structure types.
- vilhelm_s 10y agoEven without a full-blown macro system, it could be worthwhile to have a feature specifically for this. Haskell lets you write "deriving Enum" to (in effect) generate the list of values at the bottom of the blogpost automatically.