carp-lang / Carp

A statically typed lisp, without a GC, for real-time applications.
Apache License 2.0
5.51k stars 174 forks source link

Overlapping patterns in Parsing.hs #1386

Open sternenseemann opened 2 years ago

sternenseemann commented 2 years ago

GHC 9.0.2 can detect the overlaping patterns for c == '"' and x == '"' here, causing the build to fail with that GHC version at the moment due to -Werror:

[13 of 52] Compiling Parsing          ( src/Parsing.hs, dist/build/Parsing.o, dist/build/Parsing.dyn_o )

src/Parsing.hs:640:11: error: [-Woverlapping-patterns, -Werror=overlapping-patterns]
    Pattern match is redundant
    In a case alternative: ('"', '"') -> ...
    |
640 |           ('"', '"') -> Parsec.putState xs
    |           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

https://github.com/carp-lang/Carp/blob/3148703a224f0f646ca8fff18e7605671f2af839/src/Parsing.hs#L628-L640

In general, it would be a help for us packaging carp to drop -Werror from the hackage / released cabal file, since compiler releases are free to add new warnings at more or less any time, breaking the build in the process.

scolsen commented 2 years ago

Thanks for reporting—I've also found -Werror to be a bit of a hindrance during development at times. I think it'd be best if we can restrict its use to the CI/build checks for PRs.

eriksvedang commented 2 years ago

Yeah, let's make this change 👍