[GHC] #2464: Allow #ifdef'd pragmas

View: New views
2 Messages — Rating Filter:   Alert me  

[GHC] #2464: Allow #ifdef'd pragmas

by GHC-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#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
Glasgow-haskell-bugs@...
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Re: [GHC] #2464: Allow #ifdef'd pragmas

by GHC-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

#2464: Allow #ifdef'd pragmas
-------------------------------+--------------------------------------------
 Reporter:  ajd                |          Owner:            
     Type:  feature request    |         Status:  new        
 Priority:  normal             |      Milestone:  6.12 branch
Component:  Compiler (Parser)  |        Version:  6.8.2      
 Severity:  normal             |     Resolution:            
 Keywords:                     |     Difficulty:  Unknown    
 Testcase:                     |   Architecture:  Unknown    
       Os:  Unknown            |  
-------------------------------+--------------------------------------------
Changes (by igloo):

  * difficulty:  => Unknown
  * milestone:  => 6.12 branch

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2464#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@...
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
LightInTheBox - Buy quality products at wholesale price