Workaround: wrap the -1 in parens: (-1).
Thanks for the SSCCE. Follow along in #1374
Okay, making this it's own thing again because all the other things in the meta issue are done.
For my future reference: I think it should only be possible to match on Int and I'm not sure if there are any languages that permit negative numbers in matches.
Haskell allows it if it's parenthesized:
\(-3) -> 1 works on tryhaskell.org, but \-3 -> 1 gives a parse error.
OCaml works with or without parenthesis.
F# (and Fable) and Scala (Scala.js) allow negative numbers in patterns as well.
Rust also allows negatives: https://play.rust-lang.org/?gist=017c59b66ce0a3b5f080dad3cf9d2999&version=stable&mode=debug&edition=2015 .
An update for 0.19: the workaround at https://github.com/elm/compiler/issues/1261#issuecomment-172385182 no longer works. As far as I can tell, negative numbers aren't allowed in pattern matches as either the first or non-first pattern, and the presence/absence of parentheses does not make them allowed either.
@aecay See also #1773
Most helpful comment
An update for 0.19: the workaround at https://github.com/elm/compiler/issues/1261#issuecomment-172385182 no longer works. As far as I can tell, negative numbers aren't allowed in pattern matches as either the first or non-first pattern, and the presence/absence of parentheses does not make them allowed either.