Hi,
I seem to recall that there was a general issue in the compiler repository for reporting unhelpful error messages. Have I remembered it incorrectly? I couldn’t find it.
I guess whether I’m imagining it or not, my question is, where is the best place to report such messages?
Just in case anyone is curious I was trying to Dict.map
a dictionary and got a message that didn’t really point me to the real problem. (I had assumed that the function is map over values, just like List.map
but in fact it takes the key as an argument as well, that is it has type k -> a -> b
rather than a -> b
).
So a kind of minimal example is:
import Dict exposing (Dict)
type Tree
= Leaf String
dictToTree : Dict String String -> Dict String Tree
dictToTree =
Dict.map Leaf
Which leads to the error:
The 1st argument to `map` is not what I expect:
15| Dict.map Leaf
^^^^
This `Leaf` value is a:
String -> Tree
But `map` needs the 1st argument to be:
String -> b
Ellie available here: https://ellie-app.com/49jpHCQNDwqa1