Elm: unexpected '|', expecting whitespace or end of input
I recently bought "Seven more languages in seven weeks" (E-Book). I really love the "Seven .. in seven weeks" series - it's intense + challenging + mind-bending.
However, one of the things that was driving me crazy was that this simple piece of Elm code:
type Color = Black | White
generated this error:
unexpected '|'
expecting whitespace or end of input
After trying out various things, the solution turned out to be quite simple - change your Terminal settings to use ASCII instead of Unicode-8, and everything works as expected (you might want to ensure your editor of choice also uses ASCII encoding if you're not using the REPL).
Happy coding!
UPDATE
Turns out the solution wasn't related to the character encoding - it seems to be a bug in the ELM REPL where it doesn't recover once you've typed in something wrong:
franks-air:~ frank$ elm-repl