Safe Haskell warnings don't recognize pragmas
Summary
When compiled with -Wsafe
or -Wunsafe
, the warning will be printed whenever a module is inferred as either (untested, but that might be every module). This includes when an explicit safety annotation has been included in the file, in which case the author can be presumed to know whether or not it's safe.
Glaringly, the warning message says "[the module] has been inferred as safe!" when it is actually explicitly safe, no inference necessary. While this is mostly just an annoyance, if -Werror
is also passed, there is no way to actually make the compilation succeed.
Steps to reproduce
Add either the {-# LANGUAGE Safe #-}
or the {-# LANGUAGE Unsafe #-}
pragma to any module according to its safety, and rebuild with -Wsafe
or -Wunsafe
passed to GHC.
Expected behavior
Assuming the annotation is correct for the module, it should be compiled with no warnings (or at least no more than it does without the flag).
Environment
- GHC version used: 8.6.4