Distribution.Simple.Setup

Cabal-1.23.1.0: A framework for packaging Haskell software

Copyright | Isaac Jones 2003-2004 Duncan Coutts 2007
License | BSD3
Maintainer | cabal-devel@haskell.org
Portability | portable
Safe Haskell | None
Language | Haskell98

Distribution.Simple.Setup

Description

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 http://www.haskell.org/pipermail/cabal-devel/2007-December/001509.html 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.

Synopsis

- data GlobalFlags = GlobalFlags {
  - globalVersion :: Flag Bool
  - globalNumericVersion :: Flag Bool
  }
- emptyGlobalFlags :: GlobalFlags
- defaultGlobalFlags :: GlobalFlags
- globalCommand :: [Command action] -> CommandUI GlobalFlags
- data ConfigFlags = ConfigFlags {
  - configPrograms :: ProgramConfiguration
  - configProgramPaths :: [(String, FilePath)]
  - configProgramArgs :: [(String, [String])]
  - configProgramPathExtra :: NubList FilePath
  - configHcFlavor :: Flag CompilerFlavor
  - configHcPath :: Flag FilePath
  - configHcPkg :: Flag FilePath
  - configVanillaLib :: Flag Bool
  - configProfLib :: Flag Bool
  - configSharedLib :: Flag Bool
  - configDynExe :: Flag Bool
  - configProfExe :: Flag Bool
  - configProf :: Flag Bool
  - configProfDetail :: Flag ProfDetailLevel
  - configProfLibDetail :: Flag ProfDetailLevel
  - configConfigureArgs :: [String]
  - configOptimization :: Flag OptimisationLevel
  - configProgPrefix :: Flag PathTemplate
  - configProgSuffix :: Flag PathTemplate
  - configInstallDirs :: InstallDirs (Flag PathTemplate)
  - configScratchDir :: Flag FilePath
  - configExtraLibDirs :: [FilePath]
  - configExtraIncludeDirs :: [FilePath]
  - configIPID :: Flag String
  - configDistPref :: Flag FilePath
  - configVerbosity :: Flag Verbosity
  - configUserInstall :: Flag Bool
  - configPackageDBs :: [Maybe PackageDB]
  - configGHCiLib :: Flag Bool
  - configSplitObjs :: Flag Bool
  - configStripExes :: Flag Bool
  - configStripLibs :: Flag Bool
  - configConstraints :: [Dependency]
  - configDependencies :: [(PackageName, UnitId)]
  - configConfigurationsFlags :: FlagAssignment
  - configTests :: Flag Bool
  - configBenchmarks :: Flag Bool
  - configCoverage :: Flag Bool
  - configLibCoverage :: Flag Bool
  - configExactConfiguration :: Flag Bool
  - configFlagError :: Flag String
  - configRelocatable :: Flag Bool
  - configDebugInfo :: Flag DebugInfoLevel
  }
- emptyConfigFlags :: ConfigFlags
- defaultConfigFlags :: ProgramConfiguration -> ConfigFlags
- configureCommand :: ProgramConfiguration -> CommandUI ConfigFlags
- configAbsolutePaths :: ConfigFlags -> IO ConfigFlags
- readPackageDbList :: String -> [Maybe PackageDB]
- showPackageDbList :: [Maybe PackageDB] -> [String]
- data CopyFlags = CopyFlags {
  - copyDest :: Flag CopyDest
  - copyDistPref :: Flag FilePath
  - copyVerbosity :: Flag Verbosity
  }
- emptyCopyFlags :: CopyFlags
- defaultCopyFlags :: CopyFlags
- copyCommand :: CommandUI CopyFlags
- data InstallFlags = InstallFlags {
  - installPackageDB :: Flag PackageDB
  - installDistPref :: Flag FilePath
  - installUseWrapper :: Flag Bool
  - installInPlace :: Flag Bool
  - installVerbosity :: Flag Verbosity
  }
- emptyInstallFlags :: InstallFlags
- defaultInstallFlags :: InstallFlags
- installCommand :: CommandUI InstallFlags
- data HaddockFlags = HaddockFlags {
  - haddockProgramPaths :: [(String, FilePath)]
  - haddockProgramArgs :: [(String, [String])]
  - haddockHoogle :: Flag Bool
  - haddockHtml :: Flag Bool
  - haddockHtmlLocation :: Flag String
  - haddockForHackage :: Flag Bool
  - haddockExecutables :: Flag Bool
  - haddockTestSuites :: Flag Bool
  - haddockBenchmarks :: Flag Bool
  - haddockInternal :: Flag Bool
  - haddockCss :: Flag FilePath
  - haddockHscolour :: Flag Bool
  - haddockHscolourCss :: Flag FilePath
  - haddockContents :: Flag PathTemplate
  - haddockDistPref :: Flag FilePath
  - haddockKeepTempFiles :: Flag Bool
  - haddockVerbosity :: Flag Verbosity
  }
- emptyHaddockFlags :: HaddockFlags
- defaultHaddockFlags :: HaddockFlags
- haddockCommand :: CommandUI HaddockFlags
- data HscolourFlags = HscolourFlags {
  - hscolourCSS :: Flag FilePath
  - hscolourExecutables :: Flag Bool
  - hscolourTestSuites :: Flag Bool
  - hscolourBenchmarks :: Flag Bool
  - hscolourDistPref :: Flag FilePath
  - hscolourVerbosity :: Flag Verbosity
  }
- emptyHscolourFlags :: HscolourFlags
- defaultHscolourFlags :: HscolourFlags
- hscolourCommand :: CommandUI HscolourFlags
- data BuildFlags = BuildFlags {
  - buildProgramPaths :: [(String, FilePath)]
  - buildProgramArgs :: [(String, [String])]
  - buildDistPref :: Flag FilePath
  - buildVerbosity :: Flag Verbosity
  - buildNumJobs :: Flag (Maybe Int)
  - buildArgs :: [String]
  }
- emptyBuildFlags :: BuildFlags
- defaultBuildFlags :: BuildFlags
- buildCommand :: ProgramConfiguration -> CommandUI BuildFlags
- buildVerbose :: BuildFlags -> Verbosity
- data ReplFlags = ReplFlags {
  - replProgramPaths :: [(String, FilePath)]
  - replProgramArgs :: [(String, [String])]
  - replDistPref :: Flag FilePath
  - replVerbosity :: Flag Verbosity
  - replReload :: Flag Bool
  }
- defaultReplFlags :: ReplFlags
- replCommand :: ProgramConfiguration -> CommandUI ReplFlags
- data CleanFlags = CleanFlags {
  - cleanSaveConf :: Flag Bool
  - cleanDistPref :: Flag FilePath
  - cleanVerbosity :: Flag Verbosity
  }
- emptyCleanFlags :: CleanFlags
- defaultCleanFlags :: CleanFlags
- cleanCommand :: CommandUI CleanFlags
- data RegisterFlags = RegisterFlags {
  - regPackageDB :: Flag PackageDB
  - regGenScript :: Flag Bool
  - regGenPkgConf :: Flag (Maybe FilePath)
  - regInPlace :: Flag Bool
  - regDistPref :: Flag FilePath
  - regPrintId :: Flag Bool
  - regVerbosity :: Flag Verbosity
  }
- emptyRegisterFlags :: RegisterFlags
- defaultRegisterFlags :: RegisterFlags
- registerCommand :: CommandUI RegisterFlags
- unregisterCommand :: CommandUI RegisterFlags
- data SDistFlags = SDistFlags {
  - sDistSnapshot :: Flag Bool
  - sDistDirectory :: Flag FilePath
  - sDistDistPref :: Flag FilePath
  - sDistListSources :: Flag FilePath
  - sDistVerbosity :: Flag Verbosity
  }
- emptySDistFlags :: SDistFlags
- defaultSDistFlags :: SDistFlags
- sdistCommand :: CommandUI SDistFlags
- data TestFlags = TestFlags {
  - testDistPref :: Flag FilePath
  - testVerbosity :: Flag Verbosity
  - testHumanLog :: Flag PathTemplate
  - testMachineLog :: Flag PathTemplate
  - testShowDetails :: Flag TestShowDetails
  - testKeepTix :: Flag Bool
  - testOptions :: [PathTemplate]
  }
- emptyTestFlags :: TestFlags
- defaultTestFlags :: TestFlags
- testCommand :: CommandUI TestFlags
- data TestShowDetails
  - = Never
  - | Failures
  - | Always
  - | Streaming
  - | Direct
- data BenchmarkFlags = BenchmarkFlags {
  - benchmarkDistPref :: Flag FilePath
  - benchmarkVerbosity :: Flag Verbosity
  - benchmarkOptions :: [PathTemplate]
  }
- emptyBenchmarkFlags :: BenchmarkFlags
- defaultBenchmarkFlags :: BenchmarkFlags
- benchmarkCommand :: CommandUI BenchmarkFlags
- data CopyDest
  - = NoCopyDest
  - | CopyTo FilePath
- configureArgs :: Bool -> ConfigFlags -> [String]
- configureOptions :: ShowOrParseArgs -> [OptionField ConfigFlags]
- configureCCompiler :: Verbosity -> ProgramConfiguration -> IO (FilePath, [String])
- configureLinker :: Verbosity -> ProgramConfiguration -> IO (FilePath, [String])
- buildOptions :: ProgramConfiguration -> ShowOrParseArgs -> [OptionField BuildFlags]
- haddockOptions :: ShowOrParseArgs -> [OptionField HaddockFlags]
- installDirsOptions :: [OptionField (InstallDirs (Flag PathTemplate))]
- programConfigurationOptions :: ProgramConfiguration -> ShowOrParseArgs -> (flags -> [(String, [String])]) -> ([(String, [String])] -> flags -> flags) -> [OptionField flags]
- programConfigurationPaths' :: (String -> String) -> ProgramConfiguration -> ShowOrParseArgs -> (flags -> [(String, FilePath)]) -> ([(String, FilePath)] -> flags -> flags) -> [OptionField flags]
- splitArgs :: String -> [String]
- defaultDistPref :: FilePath
- optionDistPref :: (flags -> Flag FilePath) -> (Flag FilePath -> flags -> flags) -> ShowOrParseArgs -> OptionField flags
- data Flag a
  - = Flag a
  - | NoFlag
- toFlag :: a -> Flag a
- fromFlag :: Flag a -> a
- fromFlagOrDefault :: a -> Flag a -> a
- flagToMaybe :: Flag a -> Maybe a
- flagToList :: Flag a -> [a]
- boolOpt :: SFlags -> SFlags -> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
- boolOpt' :: OptFlags -> OptFlags -> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
- trueArg :: MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
- falseArg :: MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
- optionVerbosity :: (flags -> Flag Verbosity) -> (Flag Verbosity -> flags -> flags) -> OptionField flags
- optionNumJobs :: (flags -> Flag (Maybe Int)) -> (Flag (Maybe Int) -> flags -> flags) -> OptionField flags

# Documentation

data GlobalFlags Source

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

Constructors

GlobalFlags |
Fields globalVersion :: Flag Bool globalNumericVersion :: Flag Bool

Instances

Semigroup GlobalFlags |
Methods (<>) :: GlobalFlags -> GlobalFlags -> GlobalFlags Source sconcat :: NonEmpty GlobalFlags -> GlobalFlags Source stimes :: Integral b => b -> GlobalFlags -> GlobalFlags Source
Monoid GlobalFlags |
Methods mempty :: GlobalFlags Source mappend :: GlobalFlags -> GlobalFlags -> GlobalFlags Source mconcat :: [GlobalFlags] -> GlobalFlags Source

emptyGlobalFlags :: GlobalFlags Source

defaultGlobalFlags :: GlobalFlags Source

globalCommand :: [Command action] -> CommandUI GlobalFlags Source

data ConfigFlags Source

Flags to `configure` command.

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

Constructors

ConfigFlags |
Fields configPrograms :: ProgramConfiguration All programs that cabal may run configProgramPaths :: [(String, FilePath)] user specified programs paths configProgramArgs :: [(String, [String])] user specified programs args configProgramPathExtra :: NubList FilePath Extend the $PATH configHcFlavor :: Flag CompilerFlavor The "flavor" of the compiler, such as GHC or JHC. configHcPath :: Flag FilePath given compiler location configHcPkg :: Flag FilePath given hc-pkg location configVanillaLib :: Flag Bool Enable vanilla library configProfLib :: Flag Bool Enable profiling in the library configSharedLib :: Flag Bool Build shared library configDynExe :: Flag Bool Enable dynamic linking of the executables. configProfExe :: Flag Bool Enable profiling in the executables. configProf :: Flag Bool Enable profiling in the library and executables. configProfDetail :: Flag ProfDetailLevel Profiling detail level in the library and executables. configProfLibDetail :: Flag ProfDetailLevel Profiling detail level in the library configConfigureArgs :: [String] Extra arguments to `configure` configOptimization :: Flag OptimisationLevel Enable optimization. configProgPrefix :: Flag PathTemplate Installed executable prefix. configProgSuffix :: Flag PathTemplate Installed executable suffix. configInstallDirs :: InstallDirs (Flag PathTemplate) Installation paths configScratchDir :: Flag FilePath configExtraLibDirs :: [FilePath] path to search for extra libraries configExtraIncludeDirs :: [FilePath] path to search for header files configIPID :: Flag String explicit IPID to be used configDistPref :: Flag FilePath "dist" prefix configVerbosity :: Flag Verbosity verbosity level configUserInstall :: Flag Bool The --user/--global flag configPackageDBs :: [Maybe PackageDB] Which package DBs to use configGHCiLib :: Flag Bool Enable compiling library for GHCi configSplitObjs :: Flag Bool Enable -split-objs with GHC configStripExes :: Flag Bool Enable executable stripping configStripLibs :: Flag Bool Enable library stripping configConstraints :: [Dependency] Additional constraints for dependencies. configDependencies :: [(PackageName, UnitId)] The packages depended on. configConfigurationsFlags :: FlagAssignment configTests :: Flag Bool Enable test suite compilation configBenchmarks :: Flag Bool Enable benchmark compilation configCoverage :: Flag Bool Enable program coverage configLibCoverage :: Flag Bool Enable program coverage (deprecated) configExactConfiguration :: Flag Bool All direct dependencies and flags are provided on the command line by the user via the '--dependency' and '--flags' options. configFlagError :: Flag String Halt and show an error message indicating an error in flag assignment configRelocatable :: Flag Bool Enable relocatable package built configDebugInfo :: Flag DebugInfoLevel Emit debug info.

Instances

Read ConfigFlags |
Methods readsPrec :: Int -> ReadS ConfigFlags Source readList :: ReadS [ConfigFlags] Source readPrec :: ReadPrec ConfigFlags Source readListPrec :: ReadPrec [ConfigFlags] Source
Show ConfigFlags |
Methods showsPrec :: Int -> ConfigFlags -> ShowS Source show :: ConfigFlags -> String Source showList :: [ConfigFlags] -> ShowS Source
Generic ConfigFlags |
Associated Types type Rep ConfigFlags :: * -> * Source Methods from :: ConfigFlags -> Rep ConfigFlags x Source to :: Rep ConfigFlags x -> ConfigFlags Source
Semigroup ConfigFlags |
Methods (<>) :: ConfigFlags -> ConfigFlags -> ConfigFlags Source sconcat :: NonEmpty ConfigFlags -> ConfigFlags Source stimes :: Integral b => b -> ConfigFlags -> ConfigFlags Source
Monoid ConfigFlags |
Methods mempty :: ConfigFlags Source mappend :: ConfigFlags -> ConfigFlags -> ConfigFlags Source mconcat :: [ConfigFlags] -> ConfigFlags Source
Binary ConfigFlags |
Methods put :: ConfigFlags -> Put Source get :: Get ConfigFlags Source
type Rep ConfigFlags = D1 (MetaData "ConfigFlags" "Distribution.Simple.Setup" "Cabal-1.23.1.0" False) (C1 (MetaCons "ConfigFlags" PrefixI True) ((:*:) ((:*:) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "configPrograms") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ProgramConfiguration)) (S1 (MetaSel (Just Symbol "configProgramPaths") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [(String, FilePath)]))) ((:*:) (S1 (MetaSel (Just Symbol "configProgramArgs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [(String, [String])])) ((:*:) (S1 (MetaSel (Just Symbol "configProgramPathExtra") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (NubList FilePath))) (S1 (MetaSel (Just Symbol "configHcFlavor") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag CompilerFlavor)))))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "configHcPath") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag FilePath))) (S1 (MetaSel (Just Symbol "configHcPkg") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag FilePath)))) ((:*:) (S1 (MetaSel (Just Symbol "configVanillaLib") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Bool))) ((:*:) (S1 (MetaSel (Just Symbol "configProfLib") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Bool))) (S1 (MetaSel (Just Symbol "configSharedLib") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Bool))))))) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "configDynExe") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Bool))) (S1 (MetaSel (Just Symbol "configProfExe") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Bool)))) ((:*:) (S1 (MetaSel (Just Symbol "configProf") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Bool))) ((:*:) (S1 (MetaSel (Just Symbol "configProfDetail") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag ProfDetailLevel))) (S1 (MetaSel (Just Symbol "configProfLibDetail") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag ProfDetailLevel)))))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "configConfigureArgs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [String])) ((:*:) (S1 (MetaSel (Just Symbol "configOptimization") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag OptimisationLevel))) (S1 (MetaSel (Just Symbol "configProgPrefix") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag PathTemplate))))) ((:*:) (S1 (MetaSel (Just Symbol "configProgSuffix") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag PathTemplate))) ((:*:) (S1 (MetaSel (Just Symbol "configInstallDirs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (InstallDirs (Flag PathTemplate)))) (S1 (MetaSel (Just Symbol "configScratchDir") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag FilePath)))))))) ((:*:) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "configExtraLibDirs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [FilePath])) (S1 (MetaSel (Just Symbol "configExtraIncludeDirs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [FilePath]))) ((:*:) (S1 (MetaSel (Just Symbol "configIPID") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag String))) ((:*:) (S1 (MetaSel (Just Symbol "configDistPref") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag FilePath))) (S1 (MetaSel (Just Symbol "configVerbosity") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Verbosity)))))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "configUserInstall") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Bool))) ((:*:) (S1 (MetaSel (Just Symbol "configPackageDBs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Maybe PackageDB])) (S1 (MetaSel (Just Symbol "configGHCiLib") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Bool))))) ((:*:) (S1 (MetaSel (Just Symbol "configSplitObjs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Bool))) ((:*:) (S1 (MetaSel (Just Symbol "configStripExes") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Bool))) (S1 (MetaSel (Just Symbol "configStripLibs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Bool))))))) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "configConstraints") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Dependency])) (S1 (MetaSel (Just Symbol "configDependencies") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [(PackageName, UnitId)]))) ((:*:) (S1 (MetaSel (Just Symbol "configConfigurationsFlags") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 FlagAssignment)) ((:*:) (S1 (MetaSel (Just Symbol "configTests") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Bool))) (S1 (MetaSel (Just Symbol "configBenchmarks") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Bool)))))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "configCoverage") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Bool))) ((:*:) (S1 (MetaSel (Just Symbol "configLibCoverage") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Bool))) (S1 (MetaSel (Just Symbol "configExactConfiguration") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Bool))))) ((:*:) (S1 (MetaSel (Just Symbol "configFlagError") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag String))) ((:*:) (S1 (MetaSel (Just Symbol "configRelocatable") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag Bool))) (S1 (MetaSel (Just Symbol "configDebugInfo") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Flag DebugInfoLevel)))))))))) |

emptyConfigFlags :: ConfigFlags Source

defaultConfigFlags :: ProgramConfiguration -> ConfigFlags Source

configureCommand :: ProgramConfiguration -> CommandUI ConfigFlags Source

configAbsolutePaths :: ConfigFlags -> IO ConfigFlags Source

readPackageDbList :: String -> [Maybe PackageDB] Source

showPackageDbList :: [Maybe PackageDB] -> [String] Source

data CopyFlags Source

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

Constructors

CopyFlags |
Fields copyDest :: Flag CopyDest copyDistPref :: Flag FilePath copyVerbosity :: Flag Verbosity

Instances

Show CopyFlags |
Methods showsPrec :: Int -> CopyFlags -> ShowS Source show :: CopyFlags -> String Source showList :: [CopyFlags] -> ShowS Source
Semigroup CopyFlags |
Methods (<>) :: CopyFlags -> CopyFlags -> CopyFlags Source sconcat :: NonEmpty CopyFlags -> CopyFlags Source stimes :: Integral b => b -> CopyFlags -> CopyFlags Source
Monoid CopyFlags |
Methods mempty :: CopyFlags Source mappend :: CopyFlags -> CopyFlags -> CopyFlags Source mconcat :: [CopyFlags] -> CopyFlags Source

emptyCopyFlags :: CopyFlags Source

defaultCopyFlags :: CopyFlags Source

copyCommand :: CommandUI CopyFlags Source

data InstallFlags Source

Flags to `install`: (package db, verbosity)

Constructors

InstallFlags |
Fields installPackageDB :: Flag PackageDB installDistPref :: Flag FilePath installUseWrapper :: Flag Bool installInPlace :: Flag Bool installVerbosity :: Flag Verbosity

Instances

Show InstallFlags |
Methods showsPrec :: Int -> InstallFlags -> ShowS Source show :: InstallFlags -> String Source showList :: [InstallFlags] -> ShowS Source
Semigroup InstallFlags |
Methods (<>) :: InstallFlags -> InstallFlags -> InstallFlags Source sconcat :: NonEmpty InstallFlags -> InstallFlags Source stimes :: Integral b => b -> InstallFlags -> InstallFlags Source
Monoid InstallFlags |
Methods mempty :: InstallFlags Source mappend :: InstallFlags -> InstallFlags -> InstallFlags Source mconcat :: [InstallFlags] -> InstallFlags Source

emptyInstallFlags :: InstallFlags Source

defaultInstallFlags :: InstallFlags Source

installCommand :: CommandUI InstallFlags Source

data HaddockFlags Source

Constructors

HaddockFlags |
Fields haddockProgramPaths :: [(String, FilePath)] haddockProgramArgs :: [(String, [String])] haddockHoogle :: Flag Bool haddockHtml :: Flag Bool haddockHtmlLocation :: Flag String haddockForHackage :: Flag Bool haddockExecutables :: Flag Bool haddockTestSuites :: Flag Bool haddockBenchmarks :: Flag Bool haddockInternal :: Flag Bool haddockCss :: Flag FilePath haddockHscolour :: Flag Bool haddockHscolourCss :: Flag FilePath haddockContents :: Flag PathTemplate haddockDistPref :: Flag FilePath haddockKeepTempFiles :: Flag Bool haddockVerbosity :: Flag Verbosity

Instances

Show HaddockFlags |
Methods showsPrec :: Int -> HaddockFlags -> ShowS Source show :: HaddockFlags -> String Source showList :: [HaddockFlags] -> ShowS Source
Semigroup HaddockFlags |
Methods (<>) :: HaddockFlags -> HaddockFlags -> HaddockFlags Source sconcat :: NonEmpty HaddockFlags -> HaddockFlags Source stimes :: Integral b => b -> HaddockFlags -> HaddockFlags Source
Monoid HaddockFlags |
Methods mempty :: HaddockFlags Source mappend :: HaddockFlags -> HaddockFlags -> HaddockFlags Source mconcat :: [HaddockFlags] -> HaddockFlags Source

emptyHaddockFlags :: HaddockFlags Source

defaultHaddockFlags :: HaddockFlags Source

haddockCommand :: CommandUI HaddockFlags Source

data HscolourFlags Source

Constructors

HscolourFlags |
Fields hscolourCSS :: Flag FilePath hscolourExecutables :: Flag Bool hscolourTestSuites :: Flag Bool hscolourBenchmarks :: Flag Bool hscolourDistPref :: Flag FilePath hscolourVerbosity :: Flag Verbosity

Instances

Show HscolourFlags |
Methods showsPrec :: Int -> HscolourFlags -> ShowS Source show :: HscolourFlags -> String Source showList :: [HscolourFlags] -> ShowS Source
Semigroup HscolourFlags |
Methods (<>) :: HscolourFlags -> HscolourFlags -> HscolourFlags Source sconcat :: NonEmpty HscolourFlags -> HscolourFlags Source stimes :: Integral b => b -> HscolourFlags -> HscolourFlags Source
Monoid HscolourFlags |
Methods mempty :: HscolourFlags Source mappend :: HscolourFlags -> HscolourFlags -> HscolourFlags Source mconcat :: [HscolourFlags] -> HscolourFlags Source

emptyHscolourFlags :: HscolourFlags Source

defaultHscolourFlags :: HscolourFlags Source

hscolourCommand :: CommandUI HscolourFlags Source

data BuildFlags Source

Constructors

BuildFlags |
Fields buildProgramPaths :: [(String, FilePath)] buildProgramArgs :: [(String, [String])] buildDistPref :: Flag FilePath buildVerbosity :: Flag Verbosity buildNumJobs :: Flag (Maybe Int) buildArgs :: [String]

Instances

Show BuildFlags |
Methods showsPrec :: Int -> BuildFlags -> ShowS Source show :: BuildFlags -> String Source showList :: [BuildFlags] -> ShowS Source
Semigroup BuildFlags |
Methods (<>) :: BuildFlags -> BuildFlags -> BuildFlags Source sconcat :: NonEmpty BuildFlags -> BuildFlags Source stimes :: Integral b => b -> BuildFlags -> BuildFlags Source
Monoid BuildFlags |
Methods mempty :: BuildFlags Source mappend :: BuildFlags -> BuildFlags -> BuildFlags Source mconcat :: [BuildFlags] -> BuildFlags Source

emptyBuildFlags :: BuildFlags Source

defaultBuildFlags :: BuildFlags Source

buildCommand :: ProgramConfiguration -> CommandUI BuildFlags Source

buildVerbose :: BuildFlags -> Verbosity Source

Deprecated: Use buildVerbosity instead

data ReplFlags Source

Constructors

ReplFlags |
Fields replProgramPaths :: [(String, FilePath)] replProgramArgs :: [(String, [String])] replDistPref :: Flag FilePath replVerbosity :: Flag Verbosity replReload :: Flag Bool

Instances

Show ReplFlags |
Methods showsPrec :: Int -> ReplFlags -> ShowS Source show :: ReplFlags -> String Source showList :: [ReplFlags] -> ShowS Source
Semigroup ReplFlags |
Methods (<>) :: ReplFlags -> ReplFlags -> ReplFlags Source sconcat :: NonEmpty ReplFlags -> ReplFlags Source stimes :: Integral b => b -> ReplFlags -> ReplFlags Source
Monoid ReplFlags |
Methods mempty :: ReplFlags Source mappend :: ReplFlags -> ReplFlags -> ReplFlags Source mconcat :: [ReplFlags] -> ReplFlags Source

defaultReplFlags :: ReplFlags Source

replCommand :: ProgramConfiguration -> CommandUI ReplFlags Source

data CleanFlags Source

Constructors

CleanFlags |
Fields cleanSaveConf :: Flag Bool cleanDistPref :: Flag FilePath cleanVerbosity :: Flag Verbosity

Instances

Show CleanFlags |
Methods showsPrec :: Int -> CleanFlags -> ShowS Source show :: CleanFlags -> String Source showList :: [CleanFlags] -> ShowS Source
Semigroup CleanFlags |
Methods (<>) :: CleanFlags -> CleanFlags -> CleanFlags Source sconcat :: NonEmpty CleanFlags -> CleanFlags Source stimes :: Integral b => b -> CleanFlags -> CleanFlags Source
Monoid CleanFlags |
Methods mempty :: CleanFlags Source mappend :: CleanFlags -> CleanFlags -> CleanFlags Source mconcat :: [CleanFlags] -> CleanFlags Source

emptyCleanFlags :: CleanFlags Source

defaultCleanFlags :: CleanFlags Source

cleanCommand :: CommandUI CleanFlags Source

data RegisterFlags Source

Flags to `register` and `unregister`: (user package, gen-script, in-place, verbosity)

Constructors

RegisterFlags |
Fields regPackageDB :: Flag PackageDB regGenScript :: Flag Bool regGenPkgConf :: Flag (Maybe FilePath) regInPlace :: Flag Bool regDistPref :: Flag FilePath regPrintId :: Flag Bool regVerbosity :: Flag Verbosity

Instances

Show RegisterFlags |
Methods showsPrec :: Int -> RegisterFlags -> ShowS Source show :: RegisterFlags -> String Source showList :: [RegisterFlags] -> ShowS Source
Semigroup RegisterFlags |
Methods (<>) :: RegisterFlags -> RegisterFlags -> RegisterFlags Source sconcat :: NonEmpty RegisterFlags -> RegisterFlags Source stimes :: Integral b => b -> RegisterFlags -> RegisterFlags Source
Monoid RegisterFlags |
Methods mempty :: RegisterFlags Source mappend :: RegisterFlags -> RegisterFlags -> RegisterFlags Source mconcat :: [RegisterFlags] -> RegisterFlags Source

emptyRegisterFlags :: RegisterFlags Source

defaultRegisterFlags :: RegisterFlags Source

registerCommand :: CommandUI RegisterFlags Source

unregisterCommand :: CommandUI RegisterFlags Source

data SDistFlags Source

Flags to `sdist`: (snapshot, verbosity)

Constructors

SDistFlags |
Fields sDistSnapshot :: Flag Bool sDistDirectory :: Flag FilePath sDistDistPref :: Flag FilePath sDistListSources :: Flag FilePath sDistVerbosity :: Flag Verbosity

Instances

Show SDistFlags |
Methods showsPrec :: Int -> SDistFlags -> ShowS Source show :: SDistFlags -> String Source showList :: [SDistFlags] -> ShowS Source
Semigroup SDistFlags |
Methods (<>) :: SDistFlags -> SDistFlags -> SDistFlags Source sconcat :: NonEmpty SDistFlags -> SDistFlags Source stimes :: Integral b => b -> SDistFlags -> SDistFlags Source
Monoid SDistFlags |
Methods mempty :: SDistFlags Source mappend :: SDistFlags -> SDistFlags -> SDistFlags Source mconcat :: [SDistFlags] -> SDistFlags Source

emptySDistFlags :: SDistFlags Source

defaultSDistFlags :: SDistFlags Source

sdistCommand :: CommandUI SDistFlags Source

data TestFlags Source

Constructors

TestFlags |
Fields testDistPref :: Flag FilePath testVerbosity :: Flag Verbosity testHumanLog :: Flag PathTemplate testMachineLog :: Flag PathTemplate testShowDetails :: Flag TestShowDetails testKeepTix :: Flag Bool testOptions :: [PathTemplate]

Instances

Semigroup TestFlags |
Methods (<>) :: TestFlags -> TestFlags -> TestFlags Source sconcat :: NonEmpty TestFlags -> TestFlags Source stimes :: Integral b => b -> TestFlags -> TestFlags Source
Monoid TestFlags |
Methods mempty :: TestFlags Source mappend :: TestFlags -> TestFlags -> TestFlags Source mconcat :: [TestFlags] -> TestFlags Source

emptyTestFlags :: TestFlags Source

defaultTestFlags :: TestFlags Source

testCommand :: CommandUI TestFlags Source

data TestShowDetails Source

Constructors

Never |
Failures |
Always |
Streaming |
Direct |

Instances

Bounded TestShowDetails |
Methods minBound :: TestShowDetails Source maxBound :: TestShowDetails Source
Enum TestShowDetails |
Methods succ :: TestShowDetails -> TestShowDetails Source pred :: TestShowDetails -> TestShowDetails Source toEnum :: Int -> TestShowDetails Source fromEnum :: TestShowDetails -> Int Source enumFrom :: TestShowDetails -> [TestShowDetails] Source enumFromThen :: TestShowDetails -> TestShowDetails -> [TestShowDetails] Source enumFromTo :: TestShowDetails -> TestShowDetails -> [TestShowDetails] Source enumFromThenTo :: TestShowDetails -> TestShowDetails -> TestShowDetails -> [TestShowDetails] Source
Eq TestShowDetails |
Methods (==) :: TestShowDetails -> TestShowDetails -> Bool (/=) :: TestShowDetails -> TestShowDetails -> Bool
Ord TestShowDetails |
Methods compare :: TestShowDetails -> TestShowDetails -> Ordering (<) :: TestShowDetails -> TestShowDetails -> Bool (<=) :: TestShowDetails -> TestShowDetails -> Bool (>) :: TestShowDetails -> TestShowDetails -> Bool (>=) :: TestShowDetails -> TestShowDetails -> Bool max :: TestShowDetails -> TestShowDetails -> TestShowDetails min :: TestShowDetails -> TestShowDetails -> TestShowDetails
Show TestShowDetails |
Methods showsPrec :: Int -> TestShowDetails -> ShowS Source show :: TestShowDetails -> String Source showList :: [TestShowDetails] -> ShowS Source
Semigroup TestShowDetails |
Methods (<>) :: TestShowDetails -> TestShowDetails -> TestShowDetails Source sconcat :: NonEmpty TestShowDetails -> TestShowDetails Source stimes :: Integral b => b -> TestShowDetails -> TestShowDetails Source
Monoid TestShowDetails |
Methods mempty :: TestShowDetails Source mappend :: TestShowDetails -> TestShowDetails -> TestShowDetails Source mconcat :: [TestShowDetails] -> TestShowDetails Source
Text TestShowDetails |
Methods disp :: TestShowDetails -> Doc Source parse :: ReadP r TestShowDetails Source

data BenchmarkFlags Source

Constructors

BenchmarkFlags |
Fields benchmarkDistPref :: Flag FilePath benchmarkVerbosity :: Flag Verbosity benchmarkOptions :: [PathTemplate]

Instances

Semigroup BenchmarkFlags |
Methods (<>) :: BenchmarkFlags -> BenchmarkFlags -> BenchmarkFlags Source sconcat :: NonEmpty BenchmarkFlags -> BenchmarkFlags Source stimes :: Integral b => b -> BenchmarkFlags -> BenchmarkFlags Source
Monoid BenchmarkFlags |
Methods mempty :: BenchmarkFlags Source mappend :: BenchmarkFlags -> BenchmarkFlags -> BenchmarkFlags Source mconcat :: [BenchmarkFlags] -> BenchmarkFlags Source

emptyBenchmarkFlags :: BenchmarkFlags Source

defaultBenchmarkFlags :: BenchmarkFlags Source

benchmarkCommand :: CommandUI BenchmarkFlags Source

data CopyDest Source

The location prefix for the copy command.

Constructors

NoCopyDest |
CopyTo FilePath |

Instances

Eq CopyDest |
Methods (==) :: CopyDest -> CopyDest -> Bool (/=) :: CopyDest -> CopyDest -> Bool
Show CopyDest |
Methods showsPrec :: Int -> CopyDest -> ShowS Source show :: CopyDest -> String Source showList :: [CopyDest] -> ShowS Source

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

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

configureOptions :: ShowOrParseArgs -> [OptionField ConfigFlags] Source

configureCCompiler :: Verbosity -> ProgramConfiguration -> IO (FilePath, [String]) Source

configureLinker :: Verbosity -> ProgramConfiguration -> IO (FilePath, [String]) Source

buildOptions :: ProgramConfiguration -> ShowOrParseArgs -> [OptionField BuildFlags] Source

haddockOptions :: ShowOrParseArgs -> [OptionField HaddockFlags] Source

installDirsOptions :: [OptionField (InstallDirs (Flag PathTemplate))] Source

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.

splitArgs :: String -> [String] Source

Helper function to split a string into a list of arguments. It's supposed to handle quoted things sensibly, eg:

    splitArgs "--foo=\"C:\Program Files\Bar\" --baz"
      = ["--foo=C:\Program Files\Bar", "--baz"]

defaultDistPref :: FilePath Source

optionDistPref :: (flags -> Flag FilePath) -> (Flag FilePath -> flags -> flags) -> ShowOrParseArgs -> OptionField flags Source

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.

Constructors

Flag a |
NoFlag |

Instances

Functor Flag |
Methods fmap :: (a -> b) -> Flag a -> Flag b Source (<$) :: a -> Flag b -> Flag a Source
Bounded a => Bounded (Flag a) |
Methods minBound :: Flag a Source maxBound :: Flag a Source
Enum a => Enum (Flag a) |
Methods succ :: Flag a -> Flag a Source pred :: Flag a -> Flag a Source toEnum :: Int -> Flag a Source fromEnum :: Flag a -> Int Source enumFrom :: Flag a -> [Flag a] Source enumFromThen :: Flag a -> Flag a -> [Flag a] Source enumFromTo :: Flag a -> Flag a -> [Flag a] Source enumFromThenTo :: Flag a -> Flag a -> Flag a -> [Flag a] Source
Eq a => Eq (Flag a) |
Methods (==) :: Flag a -> Flag a -> Bool (/=) :: Flag a -> Flag a -> Bool
Read a => Read (Flag a) |
Methods readsPrec :: Int -> ReadS (Flag a) Source readList :: ReadS [Flag a] Source readPrec :: ReadPrec (Flag a) Source readListPrec :: ReadPrec [Flag a] Source
Show a => Show (Flag a) |
Methods showsPrec :: Int -> Flag a -> ShowS Source show :: Flag a -> String Source showList :: [Flag a] -> ShowS Source
Generic (Flag a) |
Associated Types type Rep (Flag a) :: * -> * Source Methods from :: Flag a -> Rep (Flag a) x Source to :: Rep (Flag a) x -> Flag a Source
Semigroup (Flag a) |
Methods (<>) :: Flag a -> Flag a -> Flag a Source sconcat :: NonEmpty (Flag a) -> Flag a Source stimes :: Integral b => b -> Flag a -> Flag a Source
Monoid (Flag a) |
Methods mempty :: Flag a Source mappend :: Flag a -> Flag a -> Flag a Source mconcat :: [Flag a] -> Flag a Source
Binary a => Binary (Flag a) |
Methods put :: Flag a -> Put Source get :: Get (Flag a) Source
type Rep (Flag a) = D1 (MetaData "Flag" "Distribution.Simple.Setup" "Cabal-1.23.1.0" False) ((:+:) (C1 (MetaCons "Flag" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a))) (C1 (MetaCons "NoFlag" PrefixI False) U1)) |

toFlag :: a -> Flag a Source

fromFlag :: Flag a -> a Source

fromFlagOrDefault :: a -> Flag a -> a Source

flagToMaybe :: Flag a -> Maybe 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