You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Quick Summary: When attempting to do Haskell-style pattern matching (multiple function declarations instead of one declaration with a case), the error message could be more helpful.
SSCCE
-- It's debatable whether this function is a good idea, but that's besides the point.expect:String->Maybea->aexpect _ (Just x)= x
expect msg Nothing=Debug.todo msg
This file has multiple `expect` declarations. One here:
3| expect msg Nothing = Debug.todo msg
^^^^^^
And another one here:
2| expect _ (Just x) = x
^^^^^^
How can I know which one you want? Rename one of them!
I learned Haskell before I learned Elm. Elm's similar enough that generally I can just write the same code I'd write in Haskell, and it works; when that's not the case, it's easy to get very confused (but you do know which one I want! they have distinct patterns!). Given that the mistake above is, I imagine, fairly common for (a certain type of) new Elm programmers, it'd be great if we got a more specific message, along the lines of "if you're trying to match on multiple patterns, use a single declaration and case" would be quite helpful.
The text was updated successfully, but these errors were encountered:
Quick Summary: When attempting to do Haskell-style pattern matching (multiple function declarations instead of one declaration with a
case
), the error message could be more helpful.SSCCE
Additional Details
I learned Haskell before I learned Elm. Elm's similar enough that generally I can just write the same code I'd write in Haskell, and it works; when that's not the case, it's easy to get very confused (but you do know which one I want! they have distinct patterns!). Given that the mistake above is, I imagine, fairly common for (a certain type of) new Elm programmers, it'd be great if we got a more specific message, along the lines of "if you're trying to match on multiple patterns, use a single declaration and
case
" would be quite helpful.The text was updated successfully, but these errors were encountered: