Closed Zimmi48 closed 7 years ago
Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!
Here is what to expect next, and if anyone wants to comment, keep these things in mind.
I've minimized the example to this:
type X a = X Int
v = if True then X 0 else { x = 0 }
f : X -> ()
f { x } = ()
The error report is the following:
-- TYPE MISMATCH ------------------------------------------------------- Bug.elm
The branches of this `if` produce different types of values.
3| v = if True then X 0 else { x = 0 }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The `then` branch has type:
elm-make: type applications should start with a type atom
CallStack (from HasCallStack):
error, called at src/Reporting/Render/Type.hs:411:9 in elm-compiler-0.18-8FVx3ZbYiisIpZXxx99S4A:Reporting.Render.Type
One can reproduce this on elm-lang.org/try but the error message is cut.
This is likely issue elm-complier#1373.
Additional note to googlers: I ran into this same root issue because I was not specifying a complete type (e.g. "f : X -> ()" is incorrect above, as it should be "f : X a -> ()")
You mean elm-lang/elm-compiler#1373.
It seems that this error was reported before but not for 0.18. I did not try to minimize the faulty code (no time for that). I hope the error report is useful nonetheless. The code here makes
elm-make
crash with the following error message:EDIT: for the record I'm using Linux (NixOS) but I hope the error is not specific to this OS.