Playing with Elm
Elm has fairly strict types and much of Elm programming consists of reasoning about types.
In fact, instead of runtime errors, you get special types.
Functions that might fail when determining, say, an
Int just don't return an
Int, but a
If something went wrong, and you do not happen to get your expected value, that
Maybe Int takes the value
Nothing, otherwise it takes a value like
This means that you can't really do anything useful with your
Int until you properly handled the
Super-annoying for the first 45 minutes or so, but at some point, you notice that it's actually not so bad at all.
Elm detects most of them even before you manage to run the code and it guides you to fixing it.
At first sight, Elm code looks almost like Haskell so it might need some acclimatisation for many.
But like Haskell, Elm is so much of a functional language, that there is basically no difference between variables and functions.
In fact, the statement
f = 5 could be understood as either "the variable
f is assigned a value of 5" or "the function
f takes no arguments and always returns 5".
Do you have experience with Elm? Did you do a similar comparison? I didn't at all touch upon a comparison between Elm and TypeScript or React although Elm shares some properties with both of them. Are you aware of such a comparision? How would you compare them? For all of that: Please use the comments section.