Pragma not recognised when wrapped in #ifdef

Alistair Bayley alistair at abayley.org
Tue Feb 10 07:02:34 EST 2009


> {-# LANGUAGE CPP #-}
> #ifdef PRAGMA_DERIVE_TYPEABLE
> {-# LANGUAGE DeriveDataTypeable #-}
> #else
> {-# OPTIONS -fglasgow-exts #-}
> #endif
> -- 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 )
>
> Test\Fail.hs:11:26:
>    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'


No response. I'd like to know if this is a bug (that's what it looks
like to me), or just a mistake I've made.

Thanks,
Alistair


More information about the Glasgow-haskell-users mailing list