[Hackage] #836: Provide the state of Cabal flags in an auto-generated module

Hackage cvs-ghc at haskell.org
Sun Apr 24 17:26:24 CEST 2011


#836: Provide the state of Cabal flags in an auto-generated module
----------------------------+-----------------------------------------------
  Reporter:  lemming        |        Owner:          
      Type:  enhancement    |       Status:  new     
  Priority:  normal         |    Milestone:          
 Component:  Cabal library  |      Version:  1.10.0.0
  Severity:  normal         |     Keywords:          
Difficulty:  unknown        |   Ghcversion:          
  Platform:                 |  
----------------------------+-----------------------------------------------
 I would like to query the state of cabal flags at configure time without
 CPP hackery. I would prefer to import an autogenerated module, that
 contains Bool variables with the names of the Cabal flags, just like the
 Paths module contains the paths of installed data files.

 For instance if my Cabal file contains
 {{{
 Flag buildExamples
   description: Build example executables
   default:     False

 Flag buildTests
   description: Build test suite
   default:     True

 Flag debug
   description: Compile with debug messages
   default:     False
 }}}
 and I install the package by
 {{{
 $ cabal install -fdebug
 }}}
 then the autogenerated module shall contain
 {{{
 module Flags_mypkg where

 -- | Build example executables
 buildExamples :: Bool
 buildExamples = False

 -- | Build test suite
 buildTests :: Bool
 buildTests = True

 -- | Compile with debug messages
 debug :: Bool
 debug = True
 }}}


 Maybe this feature would also solve #778.

-- 
Ticket URL: <http://hackage.haskell.org/trac/hackage/ticket/836>
Hackage <http://haskell.org/cabal/>
Hackage: Cabal and related projects



More information about the cabal-devel mailing list