[Haskell-cafe] How to set a GHC option for a single module and a
specific version of GHC?
Bernie Pope
florbitous at gmail.com
Sat Jun 5 04:28:52 EDT 2010
Hi,
I'm looking for a way to set a GHC compile option on a specific module
(not every module in the program) but only for a specific version of
GHC. Ideally within the confines of cabal, and in a portable way.
GHC provides the OPTIONS_GHC pragma, but it does not appear to provide
a way for the pragma to fire for specific versions of GHC. Also, I
can't use an #ifdef trick because "File-header pragmas are read once
only, before pre-processing the file (e.g. with cpp)."
Cabal provides conditional statements and a way to check the version
of GHC, but I can't see a way to get it to only use certain compiler
options for a particular module.
In summary, what I really want is a modified version of the OPTIONS_GHC pragma:
{-# OPTIONS_GHC ==6.12.1 ... #-}
or a way to tell cabal to use certain compiler options for a
particular module under certain conditions.
Cheers,
Bernie.
More information about the Haskell-Cafe
mailing list