Abhijit Sarkar
Abhijit Sarkar

Reputation: 24593

How to suppress warnings from external packages?

My stack build shows warning from external packages, like:

happy               > /tmp/stack-d6caed253e9f21bf/happy-1.20.0/src/ProduceGLRCode.lhs:224:12: warning: [-Wincomplete-uni-patterns] 
176happy               >     Pattern match(es) are non-exhaustive

There's not much I can do about external code, and I don't want to see these warnings. However, I still want to build my project strictly with GHC options -Wall -Werror.

Is there a way to suppress the warnings from external packages? I'm using stack with hpack. Note that the solution has to work from command line, since updating stack.yaml is not possible due to a large number of projects involved.

Things I've tried:

ghc-options:
    "$targets": -Wall -Werror
    "$everything": -w

Combined with --verbosity warn from command line, this works, but I couldn't find a way to specify the above ghc-options from the command line.

apply-ghc-options: targets

This doesn't work, warning from external packages are still visible. Besides, I couldn't find a way to specify the above apply-ghc-options from the command line.

P.S: Opened a ticket on GitHub after getting no answer here.

Upvotes: 2

Views: 146

Answers (0)

Related Questions