#2464: Allow #ifdef'd pragmas
--------------------------------+-------------------------------------------
    Reporter:  ajd              |       Owner:                   
        Type:  feature request  |      Status:  new              
    Priority:  normal           |   Component:  Compiler (Parser)
     Version:  6.8.2            |    Severity:  normal           
    Keywords:                   |    Testcase:                   
Architecture:  Unknown          |          Os:  Unknown          
--------------------------------+-------------------------------------------
 Sometimes I want to do something like

 {{{
 {-# LANGUAGE CPP #-}
 #ifdef RUN_TESTS
 {-# LANGUAGE GeneralizedNewtypeDeriving #-}
 #endif

 module Foo
   where

 #ifdef RUN_TESTS
 import Test.QuickCheck
 #endif

 newtype Bar = Bar Int
 #ifdef RUN_TESTS
   deriving Arbitrary
 #endif

 ...

 }}}

 especially (like in that example) for embedding testing code in my
 modules. I want to #ifdef the pragma so that my code stays Haskell98 when
 it's only being used, not tested, but this doesn't seem to work.

 I suppose this would require two passes of looking for pragmas if CPP was
 invoked; one before CPP and one after, because the -XCPP option can be
 invoked in a pragma.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2464>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to