Pragma not recognised when wrapped in #ifdef

Alistair Bayley alistair at
Fri Feb 6 04:02:40 EST 2009

I have this little test program:

{-# LANGUAGE DeriveDataTypeable #-}
{-# OPTIONS -fglasgow-exts #-}
-- This file is Test/Fail.hs.
-- ghc --make  -optP-DPRAGMA_DERIVE_TYPEABLE -XCPP Test.Fail
module Test.Fail where
import Data.Generics
data Fail = Fail deriving Typeable

If compile this wih the command
  ghc --make  -optP-DPRAGMA_DERIVE_TYPEABLE -XCPP Test.Fail
then I get this error from ghc-6.10.1:

[1 of 1] Compiling Test.Fail        ( Test\Fail.hs, Test\Fail.o )

    Can't make a derived instance of `Typeable Fail'
      (You need -XDeriveDataTypeable to derive an instance for this class)
    In the data type declaration for `Fail'

I've checked the preprocessor output with -E, and that looks fine. I
can compile the preprocessor output with ghc without errors.


More information about the Glasgow-haskell-users mailing list