4 ms·
Elm's developers have been working hard to make better error messages for these cases, and it really pays off even when experienced. Here are Elm's versions for
by earth_walker 4y ago
Elm's developers have been working hard to make better error messages for these cases, and it really pays off even when experienced. Here are Elm's versions for comparison:
> myfun 1 'c' 3
-- TOO MANY ARGS ---------------------------------------------------------- REPL
The `myfun` function expects 2 arguments, but it got 3 instead.
5| myfun 1 'c' 3
^^^^^
Are there any missing commas? Or missing parentheses?
> not (myfun 1)
-- TYPE MISMATCH ---------------------------------------------------------- REPL
The 1st argument to `not` is not what I expect:
5| not (myfun 1)
^^^^^^^
This `myfun` call produces:
a -> Bool
But `not` needs the 1st argument to be:
Bool
Besides being 'beginner friendly', this just takes away cognitive overhead when you can glance at an error message and immediately know what happened.
(Edit: Formatting. Note that in the console output the arrows actually line up with the source of the errors)