Reputation: 617
Can ghc somehow be convinced to treat certain types of warnings as errors and others as warnings, while still reporting them?
I hoped, this would be possible with something like this:
ghc -Werror -fwarn-missing-methods -Wwarn -fwarn-missing-signatures
, but I had no luck with that. (I think gcc doesn't support this either.)
Upvotes: 12
Views: 817
Reputation: 2221
Note that starting GHC 8.2.1, this feature exists! It was described by Trac ticket #11219 and now you can do ghc -Werror=missing-methods -Wmissing-signatures
!
Upvotes: 8
Reputation: 137947
If this is of great concern, you could consider enabling and disabling warnings on a per-module basis. So that in some modules you'd have:
{-# OPTIONS_GHC -Wall -Werror #-}
to here about everything, while in others:
{-# OPTIONS_GHC -w -Werror -fwarn-missing-methods #-}
to only enable some things as errors.
Upvotes: 2
Reputation: 139840
No, it's an all-or-nothing switch. However, you can do
ghc -Werror -fwarn-missing-methods -fno-warn-missing-signatures
Although this causes GHC to swallow the warning completely, which might not be what you wanted.
Upvotes: 5