Is there a way to just have ghc emit a warning when compiling a module after CPP?
I have resorted to just making up an undefined pragma like
Is there a way to just have ghc emit a warning when compiling a module after CPP?
I have resorted to just making up an undefined pragma like
You can do it with template Haskell:
{-# LANGUAGE TemplateHaskell #-}
import Language.Haskell.TH
$([] <$ reportWarning "foo")
Or you could create a module with a module warning:
-- in FooWarning.hs
module FooWarning {-# WARNING "foo" #-} where
-- in MonoTraversable.hs
#else
import FooWarning
#endif
I was trying with the module warning but it was warning on the compilation of modules that imported it rather than the module itself which may be better but created a large number of warnings when anything imported was used.
Yeah, I meant that you could make one empty module that is just for the warning and then import it only in your CPP blocks where you want the warning to appear.