Cabal- A framework for packaging Haskell software

CopyrightIsaac Jones 2003-2004 Duncan Coutts 2007
Safe HaskellNone



This is a big module, but not very complicated. The code is very regular and repetitive. It defines the command line interface for all the Cabal commands. For each command (like configure, build etc) it defines a type that holds all the flags, the default set of flags and a CommandUI that maps command line flags to and from the corresponding flags type.

All the flags types are instances of Monoid, see for an explanation.

The types defined here get used in the front end and especially in cabal-install which has to do quite a bit of manipulating sets of command line flags.

This is actually relatively nice, it works quite well. The main change it needs is to unify it with the code for managing sets of fields that can be read and written from files. This would allow us to save configure flags in config files.



data GlobalFlags Source

Flags that apply at the top level, not to any sub-command.

data ConfigFlags Source

Flags to configure command.

IMPORTANT: every time a new flag is added, filterConfigureFlags should be updated.




data CopyFlags Source

Flags to copy: (destdir, copy-prefix (backwards compat), verbosity)

buildVerbose :: BuildFlags -> Verbosity Source

Deprecated: Use buildVerbosity instead

data TestShowDetails Source




Bounded TestShowDetails Source 
Enum TestShowDetails Source 
Eq TestShowDetails Source 
Ord TestShowDetails Source 
Show TestShowDetails Source 
Monoid TestShowDetails Source 
Text TestShowDetails Source 

data CopyDest Source

The location prefix for the copy command.


CopyTo FilePath 

configureArgs :: Bool -> ConfigFlags -> [String] Source

Arguments to pass to a configure script, e.g. generated by autoconf.

programConfigurationOptions :: ProgramConfiguration -> ShowOrParseArgs -> (flags -> [(String, [String])]) -> ([(String, [String])] -> flags -> flags) -> [OptionField flags] Source

For each known program PROG in progConf, produce a PROG-options OptionField.

programConfigurationPaths' :: (String -> String) -> ProgramConfiguration -> ShowOrParseArgs -> (flags -> [(String, FilePath)]) -> ([(String, FilePath)] -> flags -> flags) -> [OptionField flags] Source

Like programConfigurationPaths, but allows to customise the option name.

data Flag a Source

All flags are monoids, they come in two flavours:

  1. list flags eg
--ghc-option=foo --ghc-option=bar

gives us all the values ["foo", "bar"]

  1. singular value flags, eg:
--enable-foo --disable-foo

gives us Just False So this Flag type is for the latter singular kind of flag. Its monoid instance gives us the behaviour where it starts out as NoFlag and later flags override earlier ones.


Flag a 


Functor Flag Source 


fmap :: (a -> b) -> Flag a -> Flag b

(<$) :: a -> Flag b -> Flag a

Bounded a => Bounded (Flag a) Source 


minBound :: Flag a

maxBound :: Flag a

Enum a => Enum (Flag a) Source 


succ :: Flag a -> Flag a

pred :: Flag a -> Flag a

toEnum :: Int -> Flag a

fromEnum :: Flag a -> Int

enumFrom :: Flag a -> [Flag a]

enumFromThen :: Flag a -> Flag a -> [Flag a]

enumFromTo :: Flag a -> Flag a -> [Flag a]

enumFromThenTo :: Flag a -> Flag a -> Flag a -> [Flag a]

Eq a => Eq (Flag a) Source 


(==) :: Flag a -> Flag a -> Bool

(/=) :: Flag a -> Flag a -> Bool

Read a => Read (Flag a) Source 
Show a => Show (Flag a) Source 


showsPrec :: Int -> Flag a -> ShowS

show :: Flag a -> String

showList :: [Flag a] -> ShowS

Generic (Flag a) Source 

Associated Types

type Rep (Flag a) :: * -> *


from :: Flag a -> Rep (Flag a) x

to :: Rep (Flag a) x -> Flag a

Monoid (Flag a) Source 


mempty :: Flag a

mappend :: Flag a -> Flag a -> Flag a

mconcat :: [Flag a] -> Flag a

Binary a => Binary (Flag a) Source 


put :: Flag a -> Put

get :: Get (Flag a)

type Rep (Flag a) Source 

toFlag :: a -> Flag a Source

fromFlag :: Flag a -> a Source

flagToList :: Flag a -> [a] Source

boolOpt :: SFlags -> SFlags -> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a Source

boolOpt' :: OptFlags -> OptFlags -> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a Source

trueArg :: MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a Source

falseArg :: MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a Source

optionVerbosity :: (flags -> Flag Verbosity) -> (Flag Verbosity -> flags -> flags) -> OptionField flags Source

optionNumJobs :: (flags -> Flag (Maybe Int)) -> (Flag (Maybe Int) -> flags -> flags) -> OptionField flags Source