{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE RankNTypes #-}
module Distribution.Simple.Setup (
GlobalFlags(..), emptyGlobalFlags, defaultGlobalFlags, globalCommand,
ConfigFlags(..), emptyConfigFlags, defaultConfigFlags, configureCommand,
configPrograms,
configAbsolutePaths, readPackageDb, readPackageDbList, showPackageDb, showPackageDbList,
CopyFlags(..), emptyCopyFlags, defaultCopyFlags, copyCommand,
InstallFlags(..), emptyInstallFlags, defaultInstallFlags, installCommand,
HaddockTarget(..),
HaddockFlags(..), emptyHaddockFlags, defaultHaddockFlags, haddockCommand,
Visibility(..),
HaddockProjectFlags(..), emptyHaddockProjectFlags, defaultHaddockProjectFlags, haddockProjectCommand,
HscolourFlags(..), emptyHscolourFlags, defaultHscolourFlags, hscolourCommand,
BuildFlags(..), emptyBuildFlags, defaultBuildFlags, buildCommand,
DumpBuildInfo(..),
ReplFlags(..), defaultReplFlags, replCommand,
ReplOptions(..),
CleanFlags(..), emptyCleanFlags, defaultCleanFlags, cleanCommand,
RegisterFlags(..), emptyRegisterFlags, defaultRegisterFlags, registerCommand,
unregisterCommand,
SDistFlags(..), emptySDistFlags, defaultSDistFlags, sdistCommand,
TestFlags(..), emptyTestFlags, defaultTestFlags, testCommand,
TestShowDetails(..),
BenchmarkFlags(..), emptyBenchmarkFlags,
defaultBenchmarkFlags, benchmarkCommand,
CopyDest(..),
configureArgs, configureOptions, configureCCompiler, configureLinker,
buildOptions, haddockOptions, haddockProjectOptions, installDirsOptions,
testOptions', benchmarkOptions',
programDbOptions, programDbPaths',
programFlagsDescription,
replOptions,
splitArgs,
defaultDistPref, optionDistPref,
Flag(..),
toFlag,
fromFlag,
fromFlagOrDefault,
flagToMaybe,
flagToList,
maybeToFlag,
BooleanFlag(..),
boolOpt, boolOpt', trueArg, falseArg,
optionVerbosity, optionNumJobs) where
import Prelude ()
import Distribution.Compat.Prelude hiding (get)
import Distribution.Compiler
import Distribution.ReadE
import Distribution.Parsec
import Distribution.Pretty
import qualified Distribution.Compat.CharParsing as P
import qualified Text.PrettyPrint as Disp
import Distribution.ModuleName
import Distribution.PackageDescription
import Distribution.Simple.Command hiding (boolOpt, boolOpt')
import qualified Distribution.Simple.Command as Command
import Distribution.Simple.Compiler
import Distribution.Simple.Flag
import Distribution.Simple.Utils
import Distribution.Simple.Program
import Distribution.Simple.InstallDirs
import Distribution.Verbosity
import Distribution.Utils.NubList
import Distribution.Types.ComponentId
import Distribution.Types.DumpBuildInfo
import Distribution.Types.GivenComponent
import Distribution.Types.Module
import Distribution.Types.PackageVersionConstraint
import Distribution.Compat.Stack
import Distribution.Compat.Semigroup (Last' (..), Option' (..))
defaultDistPref :: FilePath
defaultDistPref :: String
defaultDistPref = String
"dist"
data GlobalFlags = GlobalFlags {
GlobalFlags -> Flag Bool
globalVersion :: Flag Bool,
GlobalFlags -> Flag Bool
globalNumericVersion :: Flag Bool
} deriving ((forall x. GlobalFlags -> Rep GlobalFlags x)
-> (forall x. Rep GlobalFlags x -> GlobalFlags)
-> Generic GlobalFlags
forall x. Rep GlobalFlags x -> GlobalFlags
forall x. GlobalFlags -> Rep GlobalFlags x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. GlobalFlags -> Rep GlobalFlags x
from :: forall x. GlobalFlags -> Rep GlobalFlags x
$cto :: forall x. Rep GlobalFlags x -> GlobalFlags
to :: forall x. Rep GlobalFlags x -> GlobalFlags
Generic, Typeable)
defaultGlobalFlags :: GlobalFlags
defaultGlobalFlags :: GlobalFlags
defaultGlobalFlags = GlobalFlags {
globalVersion :: Flag Bool
globalVersion = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
globalNumericVersion :: Flag Bool
globalNumericVersion = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False
}
globalCommand :: [Command action] -> CommandUI GlobalFlags
globalCommand :: forall action. [Command action] -> CommandUI GlobalFlags
globalCommand [Command action]
commands = CommandUI
{ commandName :: String
commandName = String
""
, commandSynopsis :: String
commandSynopsis = String
""
, commandUsage :: String -> String
commandUsage = \String
pname ->
String
"This Setup program uses the Haskell Cabal Infrastructure.\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"See http://www.haskell.org/cabal/ for more information.\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"Usage: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
pname String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" [GLOBAL FLAGS] [COMMAND [FLAGS]]\n"
, commandDescription :: Maybe (String -> String)
commandDescription = (String -> String) -> Maybe (String -> String)
forall a. a -> Maybe a
Just ((String -> String) -> Maybe (String -> String))
-> (String -> String) -> Maybe (String -> String)
forall a b. (a -> b) -> a -> b
$ \String
pname ->
let
commands' :: [Command action]
commands' = [Command action]
commands [Command action] -> [Command action] -> [Command action]
forall a. [a] -> [a] -> [a]
++ [CommandUI () -> (() -> [String] -> action) -> Command action
forall flags action.
CommandUI flags -> (flags -> [String] -> action) -> Command action
commandAddAction CommandUI ()
helpCommandUI () -> [String] -> action
forall a. HasCallStack => a
undefined]
cmdDescs :: [(String, String)]
cmdDescs = [Command action] -> [(String, String)]
forall action. [Command action] -> [(String, String)]
getNormalCommandDescriptions [Command action]
commands'
maxlen :: Int
maxlen = [Int] -> Int
forall a. Ord a => [a] -> a
forall (t :: * -> *) a. (Foldable t, Ord a) => t a -> a
maximum ([Int] -> Int) -> [Int] -> Int
forall a b. (a -> b) -> a -> b
$ [String -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length String
name | (String
name, String
_) <- [(String, String)]
cmdDescs]
align :: String -> String
align String
str = String
str String -> String -> String
forall a. [a] -> [a] -> [a]
++ Int -> Char -> String
forall a. Int -> a -> [a]
replicate (Int
maxlen Int -> Int -> Int
forall a. Num a => a -> a -> a
- String -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length String
str) Char
' '
in
String
"Commands:\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ [String] -> String
unlines [ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String -> String
align String
name String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
descr
| (String
name, String
descr) <- [(String, String)]
cmdDescs ]
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"For more information about a command use\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
pname String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" COMMAND --help\n\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"Typical steps for installing Cabal packages:\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ [String] -> String
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat [ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
pname String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
x String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"\n"
| String
x <- [String
"configure", String
"build", String
"install"]]
, commandNotes :: Maybe (String -> String)
commandNotes = Maybe (String -> String)
forall a. Maybe a
Nothing
, commandDefaultFlags :: GlobalFlags
commandDefaultFlags = GlobalFlags
defaultGlobalFlags
, commandOptions :: ShowOrParseArgs -> [OptionField GlobalFlags]
commandOptions = \ShowOrParseArgs
_ ->
[String
-> [String]
-> String
-> (GlobalFlags -> Flag Bool)
-> (Flag Bool -> GlobalFlags -> GlobalFlags)
-> MkOptDescr
(GlobalFlags -> Flag Bool)
(Flag Bool -> GlobalFlags -> GlobalFlags)
GlobalFlags
-> OptionField GlobalFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option [Char
'V'] [String
"version"]
String
"Print version information"
GlobalFlags -> Flag Bool
globalVersion (\Flag Bool
v GlobalFlags
flags -> GlobalFlags
flags { globalVersion = v })
MkOptDescr
(GlobalFlags -> Flag Bool)
(Flag Bool -> GlobalFlags -> GlobalFlags)
GlobalFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (GlobalFlags -> Flag Bool)
-> (Flag Bool -> GlobalFlags -> GlobalFlags)
-> MkOptDescr
(GlobalFlags -> Flag Bool)
(Flag Bool -> GlobalFlags -> GlobalFlags)
GlobalFlags
-> OptionField GlobalFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option [] [String
"numeric-version"]
String
"Print just the version number"
GlobalFlags -> Flag Bool
globalNumericVersion (\Flag Bool
v GlobalFlags
flags -> GlobalFlags
flags { globalNumericVersion = v })
MkOptDescr
(GlobalFlags -> Flag Bool)
(Flag Bool -> GlobalFlags -> GlobalFlags)
GlobalFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
]
}
emptyGlobalFlags :: GlobalFlags
emptyGlobalFlags :: GlobalFlags
emptyGlobalFlags = GlobalFlags
forall a. Monoid a => a
mempty
instance Monoid GlobalFlags where
mempty :: GlobalFlags
mempty = GlobalFlags
forall a. (Generic a, GMonoid (Rep a)) => a
gmempty
mappend :: GlobalFlags -> GlobalFlags -> GlobalFlags
mappend = GlobalFlags -> GlobalFlags -> GlobalFlags
forall a. Semigroup a => a -> a -> a
(<>)
instance Semigroup GlobalFlags where
<> :: GlobalFlags -> GlobalFlags -> GlobalFlags
(<>) = GlobalFlags -> GlobalFlags -> GlobalFlags
forall a. (Generic a, GSemigroup (Rep a)) => a -> a -> a
gmappend
data ConfigFlags = ConfigFlags {
ConfigFlags -> [String]
configArgs :: [String],
ConfigFlags -> Option' (Last' ProgramDb)
configPrograms_ :: Option' (Last' ProgramDb),
ConfigFlags -> [(String, String)]
configProgramPaths :: [(String, FilePath)],
ConfigFlags -> [(String, [String])]
configProgramArgs :: [(String, [String])],
:: NubList FilePath,
ConfigFlags -> Flag CompilerFlavor
configHcFlavor :: Flag CompilerFlavor,
ConfigFlags -> Flag String
configHcPath :: Flag FilePath,
ConfigFlags -> Flag String
configHcPkg :: Flag FilePath,
ConfigFlags -> Flag Bool
configVanillaLib :: Flag Bool,
ConfigFlags -> Flag Bool
configProfLib :: Flag Bool,
ConfigFlags -> Flag Bool
configSharedLib :: Flag Bool,
ConfigFlags -> Flag Bool
configStaticLib :: Flag Bool,
ConfigFlags -> Flag Bool
configDynExe :: Flag Bool,
ConfigFlags -> Flag Bool
configFullyStaticExe :: Flag Bool,
ConfigFlags -> Flag Bool
configProfExe :: Flag Bool,
ConfigFlags -> Flag Bool
configProf :: Flag Bool,
ConfigFlags -> Flag ProfDetailLevel
configProfDetail :: Flag ProfDetailLevel,
ConfigFlags -> Flag ProfDetailLevel
configProfLibDetail :: Flag ProfDetailLevel,
ConfigFlags -> [String]
configConfigureArgs :: [String],
ConfigFlags -> Flag OptimisationLevel
configOptimization :: Flag OptimisationLevel,
ConfigFlags -> Flag PathTemplate
configProgPrefix :: Flag PathTemplate,
ConfigFlags -> Flag PathTemplate
configProgSuffix :: Flag PathTemplate,
ConfigFlags -> InstallDirs (Flag PathTemplate)
configInstallDirs :: InstallDirs (Flag PathTemplate),
ConfigFlags -> Flag String
configScratchDir :: Flag FilePath,
:: [FilePath],
:: [FilePath],
:: [FilePath],
:: [FilePath],
ConfigFlags -> Flag String
configIPID :: Flag String,
ConfigFlags -> Flag ComponentId
configCID :: Flag ComponentId,
ConfigFlags -> Flag Bool
configDeterministic :: Flag Bool,
ConfigFlags -> Flag String
configDistPref :: Flag FilePath,
ConfigFlags -> Flag String
configCabalFilePath :: Flag FilePath,
ConfigFlags -> Flag Verbosity
configVerbosity :: Flag Verbosity,
ConfigFlags -> Flag Bool
configUserInstall :: Flag Bool,
ConfigFlags -> [Maybe PackageDB]
configPackageDBs :: [Maybe PackageDB],
ConfigFlags -> Flag Bool
configGHCiLib :: Flag Bool,
ConfigFlags -> Flag Bool
configSplitSections :: Flag Bool,
ConfigFlags -> Flag Bool
configSplitObjs :: Flag Bool,
ConfigFlags -> Flag Bool
configStripExes :: Flag Bool,
ConfigFlags -> Flag Bool
configStripLibs :: Flag Bool,
ConfigFlags -> [PackageVersionConstraint]
configConstraints :: [PackageVersionConstraint],
ConfigFlags -> [GivenComponent]
configDependencies :: [GivenComponent],
ConfigFlags -> [(ModuleName, Module)]
configInstantiateWith :: [(ModuleName, Module)],
ConfigFlags -> FlagAssignment
configConfigurationsFlags :: FlagAssignment,
ConfigFlags -> Flag Bool
configTests :: Flag Bool,
ConfigFlags -> Flag Bool
configBenchmarks :: Flag Bool,
ConfigFlags -> Flag Bool
configCoverage :: Flag Bool,
ConfigFlags -> Flag Bool
configLibCoverage :: Flag Bool,
ConfigFlags -> Flag Bool
configExactConfiguration :: Flag Bool,
ConfigFlags -> Flag String
configFlagError :: Flag String,
ConfigFlags -> Flag Bool
configRelocatable :: Flag Bool,
ConfigFlags -> Flag DebugInfoLevel
configDebugInfo :: Flag DebugInfoLevel,
ConfigFlags -> Flag DumpBuildInfo
configDumpBuildInfo :: Flag DumpBuildInfo,
ConfigFlags -> Flag Bool
configUseResponseFiles :: Flag Bool,
ConfigFlags -> Flag Bool
configAllowDependingOnPrivateLibs :: Flag Bool
}
deriving ((forall x. ConfigFlags -> Rep ConfigFlags x)
-> (forall x. Rep ConfigFlags x -> ConfigFlags)
-> Generic ConfigFlags
forall x. Rep ConfigFlags x -> ConfigFlags
forall x. ConfigFlags -> Rep ConfigFlags x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ConfigFlags -> Rep ConfigFlags x
from :: forall x. ConfigFlags -> Rep ConfigFlags x
$cto :: forall x. Rep ConfigFlags x -> ConfigFlags
to :: forall x. Rep ConfigFlags x -> ConfigFlags
Generic, ReadPrec [ConfigFlags]
ReadPrec ConfigFlags
Int -> ReadS ConfigFlags
ReadS [ConfigFlags]
(Int -> ReadS ConfigFlags)
-> ReadS [ConfigFlags]
-> ReadPrec ConfigFlags
-> ReadPrec [ConfigFlags]
-> Read ConfigFlags
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS ConfigFlags
readsPrec :: Int -> ReadS ConfigFlags
$creadList :: ReadS [ConfigFlags]
readList :: ReadS [ConfigFlags]
$creadPrec :: ReadPrec ConfigFlags
readPrec :: ReadPrec ConfigFlags
$creadListPrec :: ReadPrec [ConfigFlags]
readListPrec :: ReadPrec [ConfigFlags]
Read, Int -> ConfigFlags -> String -> String
[ConfigFlags] -> String -> String
ConfigFlags -> String
(Int -> ConfigFlags -> String -> String)
-> (ConfigFlags -> String)
-> ([ConfigFlags] -> String -> String)
-> Show ConfigFlags
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> ConfigFlags -> String -> String
showsPrec :: Int -> ConfigFlags -> String -> String
$cshow :: ConfigFlags -> String
show :: ConfigFlags -> String
$cshowList :: [ConfigFlags] -> String -> String
showList :: [ConfigFlags] -> String -> String
Show, Typeable)
instance Binary ConfigFlags
instance Structured ConfigFlags
configPrograms :: WithCallStack (ConfigFlags -> ProgramDb)
configPrograms :: WithCallStack (ConfigFlags -> ProgramDb)
configPrograms = ProgramDb -> Maybe ProgramDb -> ProgramDb
forall a. a -> Maybe a -> a
fromMaybe (String -> ProgramDb
forall a. HasCallStack => String -> a
error String
"FIXME: remove configPrograms") (Maybe ProgramDb -> ProgramDb)
-> (ConfigFlags -> Maybe ProgramDb) -> ConfigFlags -> ProgramDb
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Last' ProgramDb -> ProgramDb)
-> Maybe (Last' ProgramDb) -> Maybe ProgramDb
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Last' ProgramDb -> ProgramDb
forall a. Last' a -> a
getLast'
(Maybe (Last' ProgramDb) -> Maybe ProgramDb)
-> (ConfigFlags -> Maybe (Last' ProgramDb))
-> ConfigFlags
-> Maybe ProgramDb
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Option' (Last' ProgramDb) -> Maybe (Last' ProgramDb)
forall a. Option' a -> Maybe a
getOption' (Option' (Last' ProgramDb) -> Maybe (Last' ProgramDb))
-> (ConfigFlags -> Option' (Last' ProgramDb))
-> ConfigFlags
-> Maybe (Last' ProgramDb)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ConfigFlags -> Option' (Last' ProgramDb)
configPrograms_
instance Eq ConfigFlags where
== :: ConfigFlags -> ConfigFlags -> Bool
(==) ConfigFlags
a ConfigFlags
b =
(ConfigFlags -> [(String, String)]) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> [(String, String)]
configProgramPaths
Bool -> Bool -> Bool
&& (ConfigFlags -> [(String, [String])]) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> [(String, [String])]
configProgramArgs
Bool -> Bool -> Bool
&& (ConfigFlags -> NubList String) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> NubList String
configProgramPathExtra
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag CompilerFlavor) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag CompilerFlavor
configHcFlavor
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag String) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag String
configHcPath
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag String) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag String
configHcPkg
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag Bool) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag Bool
configVanillaLib
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag Bool) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag Bool
configProfLib
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag Bool) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag Bool
configSharedLib
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag Bool) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag Bool
configStaticLib
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag Bool) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag Bool
configDynExe
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag Bool) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag Bool
configFullyStaticExe
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag Bool) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag Bool
configProfExe
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag Bool) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag Bool
configProf
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag ProfDetailLevel) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag ProfDetailLevel
configProfDetail
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag ProfDetailLevel) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag ProfDetailLevel
configProfLibDetail
Bool -> Bool -> Bool
&& (ConfigFlags -> [String]) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> [String]
configConfigureArgs
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag OptimisationLevel) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag OptimisationLevel
configOptimization
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag PathTemplate) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag PathTemplate
configProgPrefix
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag PathTemplate) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag PathTemplate
configProgSuffix
Bool -> Bool -> Bool
&& (ConfigFlags -> InstallDirs (Flag PathTemplate)) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> InstallDirs (Flag PathTemplate)
configInstallDirs
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag String) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag String
configScratchDir
Bool -> Bool -> Bool
&& (ConfigFlags -> [String]) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> [String]
configExtraLibDirs
Bool -> Bool -> Bool
&& (ConfigFlags -> [String]) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> [String]
configExtraLibDirsStatic
Bool -> Bool -> Bool
&& (ConfigFlags -> [String]) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> [String]
configExtraIncludeDirs
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag String) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag String
configIPID
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag Bool) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag Bool
configDeterministic
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag String) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag String
configDistPref
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag Verbosity) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag Verbosity
configVerbosity
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag Bool) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag Bool
configUserInstall
Bool -> Bool -> Bool
&& (ConfigFlags -> [Maybe PackageDB]) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> [Maybe PackageDB]
configPackageDBs
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag Bool) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag Bool
configGHCiLib
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag Bool) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag Bool
configSplitSections
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag Bool) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag Bool
configSplitObjs
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag Bool) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag Bool
configStripExes
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag Bool) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag Bool
configStripLibs
Bool -> Bool -> Bool
&& (ConfigFlags -> [PackageVersionConstraint]) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> [PackageVersionConstraint]
configConstraints
Bool -> Bool -> Bool
&& (ConfigFlags -> [GivenComponent]) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> [GivenComponent]
configDependencies
Bool -> Bool -> Bool
&& (ConfigFlags -> FlagAssignment) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> FlagAssignment
configConfigurationsFlags
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag Bool) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag Bool
configTests
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag Bool) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag Bool
configBenchmarks
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag Bool) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag Bool
configCoverage
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag Bool) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag Bool
configLibCoverage
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag Bool) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag Bool
configExactConfiguration
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag String) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag String
configFlagError
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag Bool) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag Bool
configRelocatable
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag DebugInfoLevel) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag DebugInfoLevel
configDebugInfo
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag DumpBuildInfo) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag DumpBuildInfo
configDumpBuildInfo
Bool -> Bool -> Bool
&& (ConfigFlags -> Flag Bool) -> Bool
forall {b}. Eq b => (ConfigFlags -> b) -> Bool
equal ConfigFlags -> Flag Bool
configUseResponseFiles
where
equal :: (ConfigFlags -> b) -> Bool
equal ConfigFlags -> b
f = (b -> b -> Bool)
-> (ConfigFlags -> b) -> ConfigFlags -> ConfigFlags -> Bool
forall b c a. (b -> b -> c) -> (a -> b) -> a -> a -> c
on b -> b -> Bool
forall a. Eq a => a -> a -> Bool
(==) ConfigFlags -> b
f ConfigFlags
a ConfigFlags
b
configAbsolutePaths :: ConfigFlags -> IO ConfigFlags
configAbsolutePaths :: ConfigFlags -> IO ConfigFlags
configAbsolutePaths ConfigFlags
f =
(\[Maybe PackageDB]
v -> ConfigFlags
f { configPackageDBs = v })
([Maybe PackageDB] -> ConfigFlags)
-> IO [Maybe PackageDB] -> IO ConfigFlags
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
`liftM` (Maybe PackageDB -> IO (Maybe PackageDB))
-> [Maybe PackageDB] -> IO [Maybe PackageDB]
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> [a] -> f [b]
traverse (IO (Maybe PackageDB)
-> (PackageDB -> IO (Maybe PackageDB))
-> Maybe PackageDB
-> IO (Maybe PackageDB)
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (Maybe PackageDB -> IO (Maybe PackageDB)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe PackageDB
forall a. Maybe a
Nothing) ((PackageDB -> Maybe PackageDB)
-> IO PackageDB -> IO (Maybe PackageDB)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM PackageDB -> Maybe PackageDB
forall a. a -> Maybe a
Just (IO PackageDB -> IO (Maybe PackageDB))
-> (PackageDB -> IO PackageDB) -> PackageDB -> IO (Maybe PackageDB)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PackageDB -> IO PackageDB
absolutePackageDBPath))
(ConfigFlags -> [Maybe PackageDB]
configPackageDBs ConfigFlags
f)
defaultConfigFlags :: ProgramDb -> ConfigFlags
defaultConfigFlags :: ProgramDb -> ConfigFlags
defaultConfigFlags ProgramDb
progDb = ConfigFlags
emptyConfigFlags {
configArgs = [],
configPrograms_ = Option' (Just (Last' progDb)),
configHcFlavor = maybe NoFlag Flag defaultCompilerFlavor,
configVanillaLib = Flag True,
configProfLib = NoFlag,
configSharedLib = NoFlag,
configStaticLib = NoFlag,
configDynExe = Flag False,
configFullyStaticExe = Flag False,
configProfExe = NoFlag,
configProf = NoFlag,
configProfDetail = NoFlag,
configProfLibDetail= NoFlag,
configOptimization = Flag NormalOptimisation,
configProgPrefix = Flag (toPathTemplate ""),
configProgSuffix = Flag (toPathTemplate ""),
configDistPref = NoFlag,
configCabalFilePath = NoFlag,
configVerbosity = Flag normal,
configUserInstall = Flag False,
#if defined(mingw32_HOST_OS)
configGHCiLib = Flag False,
#else
configGHCiLib = NoFlag,
#endif
configSplitSections = Flag False,
configSplitObjs = Flag False,
configStripExes = NoFlag,
configStripLibs = NoFlag,
configTests = Flag False,
configBenchmarks = Flag False,
configCoverage = Flag False,
configLibCoverage = NoFlag,
configExactConfiguration = Flag False,
configFlagError = NoFlag,
configRelocatable = Flag False,
configDebugInfo = Flag NoDebugInfo,
configDumpBuildInfo = NoFlag,
configUseResponseFiles = NoFlag
}
configureCommand :: ProgramDb -> CommandUI ConfigFlags
configureCommand :: ProgramDb -> CommandUI ConfigFlags
configureCommand ProgramDb
progDb = CommandUI
{ commandName :: String
commandName = String
"configure"
, commandSynopsis :: String
commandSynopsis = String
"Prepare to build the package."
, commandDescription :: Maybe (String -> String)
commandDescription = (String -> String) -> Maybe (String -> String)
forall a. a -> Maybe a
Just ((String -> String) -> Maybe (String -> String))
-> (String -> String) -> Maybe (String -> String)
forall a b. (a -> b) -> a -> b
$ \String
_ -> String -> String
wrapText (String -> String) -> String -> String
forall a b. (a -> b) -> a -> b
$
String
"Configure how the package is built by setting "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"package (and other) flags.\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"The configuration affects several other commands, "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"including build, test, bench, run, repl.\n"
, commandNotes :: Maybe (String -> String)
commandNotes = (String -> String) -> Maybe (String -> String)
forall a. a -> Maybe a
Just ((String -> String) -> Maybe (String -> String))
-> (String -> String) -> Maybe (String -> String)
forall a b. (a -> b) -> a -> b
$ \String
_pname -> ProgramDb -> String
programFlagsDescription ProgramDb
progDb
, commandUsage :: String -> String
commandUsage = \String
pname ->
String
"Usage: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
pname String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" configure [FLAGS]\n"
, commandDefaultFlags :: ConfigFlags
commandDefaultFlags = ProgramDb -> ConfigFlags
defaultConfigFlags ProgramDb
progDb
, commandOptions :: ShowOrParseArgs -> [OptionField ConfigFlags]
commandOptions = \ShowOrParseArgs
showOrParseArgs ->
ShowOrParseArgs -> [OptionField ConfigFlags]
configureOptions ShowOrParseArgs
showOrParseArgs
[OptionField ConfigFlags]
-> [OptionField ConfigFlags] -> [OptionField ConfigFlags]
forall a. [a] -> [a] -> [a]
++ ProgramDb
-> ShowOrParseArgs
-> (ConfigFlags -> [(String, String)])
-> ([(String, String)] -> ConfigFlags -> ConfigFlags)
-> [OptionField ConfigFlags]
forall flags.
ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, String)])
-> ([(String, String)] -> flags -> flags)
-> [OptionField flags]
programDbPaths ProgramDb
progDb ShowOrParseArgs
showOrParseArgs
ConfigFlags -> [(String, String)]
configProgramPaths (\[(String, String)]
v ConfigFlags
fs -> ConfigFlags
fs { configProgramPaths = v })
[OptionField ConfigFlags]
-> [OptionField ConfigFlags] -> [OptionField ConfigFlags]
forall a. [a] -> [a] -> [a]
++ ProgramDb
-> ShowOrParseArgs
-> (ConfigFlags -> [(String, [String])])
-> ([(String, [String])] -> ConfigFlags -> ConfigFlags)
-> [OptionField ConfigFlags]
forall flags.
ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, [String])])
-> ([(String, [String])] -> flags -> flags)
-> [OptionField flags]
programDbOption ProgramDb
progDb ShowOrParseArgs
showOrParseArgs
ConfigFlags -> [(String, [String])]
configProgramArgs (\[(String, [String])]
v ConfigFlags
fs -> ConfigFlags
fs { configProgramArgs = v })
[OptionField ConfigFlags]
-> [OptionField ConfigFlags] -> [OptionField ConfigFlags]
forall a. [a] -> [a] -> [a]
++ ProgramDb
-> ShowOrParseArgs
-> (ConfigFlags -> [(String, [String])])
-> ([(String, [String])] -> ConfigFlags -> ConfigFlags)
-> [OptionField ConfigFlags]
forall flags.
ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, [String])])
-> ([(String, [String])] -> flags -> flags)
-> [OptionField flags]
programDbOptions ProgramDb
progDb ShowOrParseArgs
showOrParseArgs
ConfigFlags -> [(String, [String])]
configProgramArgs (\[(String, [String])]
v ConfigFlags
fs -> ConfigFlags
fs { configProgramArgs = v })
}
parsecModSubstEntry :: ParsecParser (ModuleName, Module)
parsecModSubstEntry :: ParsecParser (ModuleName, Module)
parsecModSubstEntry = do
ModuleName
k <- ParsecParser ModuleName
forall a (m :: * -> *). (Parsec a, CabalParsing m) => m a
forall (m :: * -> *). CabalParsing m => m ModuleName
parsec
Char
_ <- Char -> ParsecParser Char
forall (m :: * -> *). CharParsing m => Char -> m Char
P.char Char
'='
Module
v <- ParsecParser Module
forall a (m :: * -> *). (Parsec a, CabalParsing m) => m a
forall (m :: * -> *). CabalParsing m => m Module
parsec
(ModuleName, Module) -> ParsecParser (ModuleName, Module)
forall a. a -> ParsecParser a
forall (m :: * -> *) a. Monad m => a -> m a
return (ModuleName
k, Module
v)
dispModSubstEntry :: (ModuleName, Module) -> Disp.Doc
dispModSubstEntry :: (ModuleName, Module) -> Doc
dispModSubstEntry (ModuleName
k, Module
v) = ModuleName -> Doc
forall a. Pretty a => a -> Doc
pretty ModuleName
k Doc -> Doc -> Doc
<<>> Char -> Doc
Disp.char Char
'=' Doc -> Doc -> Doc
<<>> Module -> Doc
forall a. Pretty a => a -> Doc
pretty Module
v
configureOptions :: ShowOrParseArgs -> [OptionField ConfigFlags]
configureOptions :: ShowOrParseArgs -> [OptionField ConfigFlags]
configureOptions ShowOrParseArgs
showOrParseArgs =
[(ConfigFlags -> Flag Verbosity)
-> (Flag Verbosity -> ConfigFlags -> ConfigFlags)
-> OptionField ConfigFlags
forall flags.
(flags -> Flag Verbosity)
-> (Flag Verbosity -> flags -> flags) -> OptionField flags
optionVerbosity ConfigFlags -> Flag Verbosity
configVerbosity
(\Flag Verbosity
v ConfigFlags
flags -> ConfigFlags
flags { configVerbosity = v })
,(ConfigFlags -> Flag String)
-> (Flag String -> ConfigFlags -> ConfigFlags)
-> ShowOrParseArgs
-> OptionField ConfigFlags
forall flags.
(flags -> Flag String)
-> (Flag String -> flags -> flags)
-> ShowOrParseArgs
-> OptionField flags
optionDistPref
ConfigFlags -> Flag String
configDistPref (\Flag String
d ConfigFlags
flags -> ConfigFlags
flags { configDistPref = d })
ShowOrParseArgs
showOrParseArgs
,String
-> [String]
-> String
-> (ConfigFlags -> Flag CompilerFlavor)
-> (Flag CompilerFlavor -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag CompilerFlavor)
(Flag CompilerFlavor -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option [] [String
"compiler"] String
"compiler"
ConfigFlags -> Flag CompilerFlavor
configHcFlavor (\Flag CompilerFlavor
v ConfigFlags
flags -> ConfigFlags
flags { configHcFlavor = v })
([(Flag CompilerFlavor, (String, [String]), String)]
-> MkOptDescr
(ConfigFlags -> Flag CompilerFlavor)
(Flag CompilerFlavor -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall b a.
Eq b =>
[(b, (String, [String]), String)]
-> MkOptDescr (a -> b) (b -> a -> a) a
choiceOpt [ (CompilerFlavor -> Flag CompilerFlavor
forall a. a -> Flag a
Flag CompilerFlavor
GHC, (String
"g", [String
"ghc"]), String
"compile with GHC")
, (CompilerFlavor -> Flag CompilerFlavor
forall a. a -> Flag a
Flag CompilerFlavor
GHCJS, ([] , [String
"ghcjs"]), String
"compile with GHCJS")
, (CompilerFlavor -> Flag CompilerFlavor
forall a. a -> Flag a
Flag CompilerFlavor
UHC, ([] , [String
"uhc"]), String
"compile with UHC")
, (CompilerFlavor -> Flag CompilerFlavor
forall a. a -> Flag a
Flag (String -> CompilerFlavor
HaskellSuite String
"haskell-suite"), ([] , [String
"haskell-suite"]),
String
"compile with a haskell-suite compiler")])
,String
-> [String]
-> String
-> (ConfigFlags -> Flag String)
-> (Flag String -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag String)
(Flag String -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"cabal-file"]
String
"use this Cabal file"
ConfigFlags -> Flag String
configCabalFilePath (\Flag String
v ConfigFlags
flags -> ConfigFlags
flags { configCabalFilePath = v })
(String
-> MkOptDescr
(ConfigFlags -> Flag String)
(Flag String -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
"PATH")
,String
-> [String]
-> String
-> (ConfigFlags -> Flag String)
-> (Flag String -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag String)
(Flag String -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"w" [String
"with-compiler"]
String
"give the path to a particular compiler"
ConfigFlags -> Flag String
configHcPath (\Flag String
v ConfigFlags
flags -> ConfigFlags
flags { configHcPath = v })
(String
-> MkOptDescr
(ConfigFlags -> Flag String)
(Flag String -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
"PATH")
,String
-> [String]
-> String
-> (ConfigFlags -> Flag String)
-> (Flag String -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag String)
(Flag String -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"with-hc-pkg"]
String
"give the path to the package tool"
ConfigFlags -> Flag String
configHcPkg (\Flag String
v ConfigFlags
flags -> ConfigFlags
flags { configHcPkg = v })
(String
-> MkOptDescr
(ConfigFlags -> Flag String)
(Flag String -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
"PATH")
]
[OptionField ConfigFlags]
-> [OptionField ConfigFlags] -> [OptionField ConfigFlags]
forall a. [a] -> [a] -> [a]
++ (OptionField (InstallDirs (Flag PathTemplate))
-> OptionField ConfigFlags)
-> [OptionField (InstallDirs (Flag PathTemplate))]
-> [OptionField ConfigFlags]
forall a b. (a -> b) -> [a] -> [b]
map OptionField (InstallDirs (Flag PathTemplate))
-> OptionField ConfigFlags
liftInstallDirs [OptionField (InstallDirs (Flag PathTemplate))]
installDirsOptions
[OptionField ConfigFlags]
-> [OptionField ConfigFlags] -> [OptionField ConfigFlags]
forall a. [a] -> [a] -> [a]
++ [String
-> [String]
-> String
-> (ConfigFlags -> Flag PathTemplate)
-> (Flag PathTemplate -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag PathTemplate)
(Flag PathTemplate -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"program-prefix"]
String
"prefix to be applied to installed executables"
ConfigFlags -> Flag PathTemplate
configProgPrefix
(\Flag PathTemplate
v ConfigFlags
flags -> ConfigFlags
flags { configProgPrefix = v })
(String
-> MkOptDescr
(ConfigFlags -> Flag PathTemplate)
(Flag PathTemplate -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall {b}.
String
-> String
-> [String]
-> String
-> (b -> Flag PathTemplate)
-> (Flag PathTemplate -> b -> b)
-> OptDescr b
reqPathTemplateArgFlag String
"PREFIX")
,String
-> [String]
-> String
-> (ConfigFlags -> Flag PathTemplate)
-> (Flag PathTemplate -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag PathTemplate)
(Flag PathTemplate -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"program-suffix"]
String
"suffix to be applied to installed executables"
ConfigFlags -> Flag PathTemplate
configProgSuffix (\Flag PathTemplate
v ConfigFlags
flags -> ConfigFlags
flags { configProgSuffix = v } )
(String
-> MkOptDescr
(ConfigFlags -> Flag PathTemplate)
(Flag PathTemplate -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall {b}.
String
-> String
-> [String]
-> String
-> (b -> Flag PathTemplate)
-> (Flag PathTemplate -> b -> b)
-> OptDescr b
reqPathTemplateArgFlag String
"SUFFIX")
,String
-> [String]
-> String
-> (ConfigFlags -> Flag Bool)
-> (Flag Bool -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"library-vanilla"]
String
"Vanilla libraries"
ConfigFlags -> Flag Bool
configVanillaLib (\Flag Bool
v ConfigFlags
flags -> ConfigFlags
flags { configVanillaLib = v })
(String
-> String
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall a.
String
-> String -> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
boolOpt [] [])
,String
-> [String]
-> String
-> (ConfigFlags -> Flag Bool)
-> (Flag Bool -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"p" [String
"library-profiling"]
String
"Library profiling"
ConfigFlags -> Flag Bool
configProfLib (\Flag Bool
v ConfigFlags
flags -> ConfigFlags
flags { configProfLib = v })
(String
-> String
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall a.
String
-> String -> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
boolOpt String
"p" [])
,String
-> [String]
-> String
-> (ConfigFlags -> Flag Bool)
-> (Flag Bool -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"shared"]
String
"Shared library"
ConfigFlags -> Flag Bool
configSharedLib (\Flag Bool
v ConfigFlags
flags -> ConfigFlags
flags { configSharedLib = v })
(String
-> String
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall a.
String
-> String -> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
boolOpt [] [])
,String
-> [String]
-> String
-> (ConfigFlags -> Flag Bool)
-> (Flag Bool -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"static"]
String
"Static library"
ConfigFlags -> Flag Bool
configStaticLib (\Flag Bool
v ConfigFlags
flags -> ConfigFlags
flags { configStaticLib = v })
(String
-> String
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall a.
String
-> String -> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
boolOpt [] [])
,String
-> [String]
-> String
-> (ConfigFlags -> Flag Bool)
-> (Flag Bool -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"executable-dynamic"]
String
"Executable dynamic linking"
ConfigFlags -> Flag Bool
configDynExe (\Flag Bool
v ConfigFlags
flags -> ConfigFlags
flags { configDynExe = v })
(String
-> String
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall a.
String
-> String -> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
boolOpt [] [])
,String
-> [String]
-> String
-> (ConfigFlags -> Flag Bool)
-> (Flag Bool -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"executable-static"]
String
"Executable fully static linking"
ConfigFlags -> Flag Bool
configFullyStaticExe (\Flag Bool
v ConfigFlags
flags -> ConfigFlags
flags { configFullyStaticExe = v })
(String
-> String
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall a.
String
-> String -> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
boolOpt [] [])
,String
-> [String]
-> String
-> (ConfigFlags -> Flag Bool)
-> (Flag Bool -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"profiling"]
String
"Executable and library profiling"
ConfigFlags -> Flag Bool
configProf (\Flag Bool
v ConfigFlags
flags -> ConfigFlags
flags { configProf = v })
(String
-> String
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall a.
String
-> String -> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
boolOpt [] [])
,String
-> [String]
-> String
-> (ConfigFlags -> Flag Bool)
-> (Flag Bool -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"executable-profiling"]
String
"Executable profiling (DEPRECATED)"
ConfigFlags -> Flag Bool
configProfExe (\Flag Bool
v ConfigFlags
flags -> ConfigFlags
flags { configProfExe = v })
(String
-> String
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall a.
String
-> String -> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
boolOpt [] [])
,String
-> [String]
-> String
-> (ConfigFlags -> Flag ProfDetailLevel)
-> (Flag ProfDetailLevel -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag ProfDetailLevel)
(Flag ProfDetailLevel -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"profiling-detail"]
(String
"Profiling detail level for executable and library (default, " String -> String -> String
forall a. [a] -> [a] -> [a]
++
String
"none, exported-functions, toplevel-functions, all-functions).")
ConfigFlags -> Flag ProfDetailLevel
configProfDetail (\Flag ProfDetailLevel
v ConfigFlags
flags -> ConfigFlags
flags { configProfDetail = v })
(String
-> (String -> Flag ProfDetailLevel)
-> (Flag ProfDetailLevel -> [String])
-> MkOptDescr
(ConfigFlags -> Flag ProfDetailLevel)
(Flag ProfDetailLevel -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall b a.
Monoid b =>
String
-> (String -> b)
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg' String
"level" (ProfDetailLevel -> Flag ProfDetailLevel
forall a. a -> Flag a
Flag (ProfDetailLevel -> Flag ProfDetailLevel)
-> (String -> ProfDetailLevel) -> String -> Flag ProfDetailLevel
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> ProfDetailLevel
flagToProfDetailLevel)
Flag ProfDetailLevel -> [String]
showProfDetailLevelFlag)
,String
-> [String]
-> String
-> (ConfigFlags -> Flag ProfDetailLevel)
-> (Flag ProfDetailLevel -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag ProfDetailLevel)
(Flag ProfDetailLevel -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"library-profiling-detail"]
String
"Profiling detail level for libraries only."
ConfigFlags -> Flag ProfDetailLevel
configProfLibDetail (\Flag ProfDetailLevel
v ConfigFlags
flags -> ConfigFlags
flags { configProfLibDetail = v })
(String
-> (String -> Flag ProfDetailLevel)
-> (Flag ProfDetailLevel -> [String])
-> MkOptDescr
(ConfigFlags -> Flag ProfDetailLevel)
(Flag ProfDetailLevel -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall b a.
Monoid b =>
String
-> (String -> b)
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg' String
"level" (ProfDetailLevel -> Flag ProfDetailLevel
forall a. a -> Flag a
Flag (ProfDetailLevel -> Flag ProfDetailLevel)
-> (String -> ProfDetailLevel) -> String -> Flag ProfDetailLevel
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> ProfDetailLevel
flagToProfDetailLevel)
Flag ProfDetailLevel -> [String]
showProfDetailLevelFlag)
,String
-> (ConfigFlags -> Flag OptimisationLevel)
-> (Flag OptimisationLevel -> ConfigFlags -> ConfigFlags)
-> [(ConfigFlags -> Flag OptimisationLevel)
-> (Flag OptimisationLevel -> ConfigFlags -> ConfigFlags)
-> OptDescr ConfigFlags]
-> OptionField ConfigFlags
forall get set a.
String -> get -> set -> [get -> set -> OptDescr a] -> OptionField a
multiOption String
"optimization"
ConfigFlags -> Flag OptimisationLevel
configOptimization (\Flag OptimisationLevel
v ConfigFlags
flags -> ConfigFlags
flags { configOptimization = v })
[String
-> (Maybe String -> Flag OptimisationLevel)
-> (Flag OptimisationLevel -> [Maybe String])
-> MkOptDescr
(ConfigFlags -> Flag OptimisationLevel)
(Flag OptimisationLevel -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall b a.
Monoid b =>
String
-> (Maybe String -> b)
-> (b -> [Maybe String])
-> MkOptDescr (a -> b) (b -> a -> a) a
optArg' String
"n" (OptimisationLevel -> Flag OptimisationLevel
forall a. a -> Flag a
Flag (OptimisationLevel -> Flag OptimisationLevel)
-> (Maybe String -> OptimisationLevel)
-> Maybe String
-> Flag OptimisationLevel
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Maybe String -> OptimisationLevel
flagToOptimisationLevel)
(\Flag OptimisationLevel
f -> case Flag OptimisationLevel
f of
Flag OptimisationLevel
NoOptimisation -> []
Flag OptimisationLevel
NormalOptimisation -> [Maybe String
forall a. Maybe a
Nothing]
Flag OptimisationLevel
MaximumOptimisation -> [String -> Maybe String
forall a. a -> Maybe a
Just String
"2"]
Flag OptimisationLevel
_ -> [])
String
"O" [String
"enable-optimization",String
"enable-optimisation"]
String
"Build with optimization (n is 0--2, default is 1)",
Flag OptimisationLevel
-> MkOptDescr
(ConfigFlags -> Flag OptimisationLevel)
(Flag OptimisationLevel -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall b a. Eq b => b -> MkOptDescr (a -> b) (b -> a -> a) a
noArg (OptimisationLevel -> Flag OptimisationLevel
forall a. a -> Flag a
Flag OptimisationLevel
NoOptimisation) []
[String
"disable-optimization",String
"disable-optimisation"]
String
"Build without optimization"
]
,String
-> (ConfigFlags -> Flag DebugInfoLevel)
-> (Flag DebugInfoLevel -> ConfigFlags -> ConfigFlags)
-> [(ConfigFlags -> Flag DebugInfoLevel)
-> (Flag DebugInfoLevel -> ConfigFlags -> ConfigFlags)
-> OptDescr ConfigFlags]
-> OptionField ConfigFlags
forall get set a.
String -> get -> set -> [get -> set -> OptDescr a] -> OptionField a
multiOption String
"debug-info"
ConfigFlags -> Flag DebugInfoLevel
configDebugInfo (\Flag DebugInfoLevel
v ConfigFlags
flags -> ConfigFlags
flags { configDebugInfo = v })
[String
-> (Maybe String -> Flag DebugInfoLevel)
-> (Flag DebugInfoLevel -> [Maybe String])
-> MkOptDescr
(ConfigFlags -> Flag DebugInfoLevel)
(Flag DebugInfoLevel -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall b a.
Monoid b =>
String
-> (Maybe String -> b)
-> (b -> [Maybe String])
-> MkOptDescr (a -> b) (b -> a -> a) a
optArg' String
"n" (DebugInfoLevel -> Flag DebugInfoLevel
forall a. a -> Flag a
Flag (DebugInfoLevel -> Flag DebugInfoLevel)
-> (Maybe String -> DebugInfoLevel)
-> Maybe String
-> Flag DebugInfoLevel
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Maybe String -> DebugInfoLevel
flagToDebugInfoLevel)
(\Flag DebugInfoLevel
f -> case Flag DebugInfoLevel
f of
Flag DebugInfoLevel
NoDebugInfo -> []
Flag DebugInfoLevel
MinimalDebugInfo -> [String -> Maybe String
forall a. a -> Maybe a
Just String
"1"]
Flag DebugInfoLevel
NormalDebugInfo -> [Maybe String
forall a. Maybe a
Nothing]
Flag DebugInfoLevel
MaximalDebugInfo -> [String -> Maybe String
forall a. a -> Maybe a
Just String
"3"]
Flag DebugInfoLevel
_ -> [])
String
"" [String
"enable-debug-info"]
String
"Emit debug info (n is 0--3, default is 0)",
Flag DebugInfoLevel
-> MkOptDescr
(ConfigFlags -> Flag DebugInfoLevel)
(Flag DebugInfoLevel -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall b a. Eq b => b -> MkOptDescr (a -> b) (b -> a -> a) a
noArg (DebugInfoLevel -> Flag DebugInfoLevel
forall a. a -> Flag a
Flag DebugInfoLevel
NoDebugInfo) []
[String
"disable-debug-info"]
String
"Don't emit debug info"
]
, String
-> (ConfigFlags -> Flag DumpBuildInfo)
-> (Flag DumpBuildInfo -> ConfigFlags -> ConfigFlags)
-> [(ConfigFlags -> Flag DumpBuildInfo)
-> (Flag DumpBuildInfo -> ConfigFlags -> ConfigFlags)
-> OptDescr ConfigFlags]
-> OptionField ConfigFlags
forall get set a.
String -> get -> set -> [get -> set -> OptDescr a] -> OptionField a
multiOption String
"build-info"
ConfigFlags -> Flag DumpBuildInfo
configDumpBuildInfo
(\Flag DumpBuildInfo
v ConfigFlags
flags -> ConfigFlags
flags { configDumpBuildInfo = v })
[Flag DumpBuildInfo
-> MkOptDescr
(ConfigFlags -> Flag DumpBuildInfo)
(Flag DumpBuildInfo -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall b a. Eq b => b -> MkOptDescr (a -> b) (b -> a -> a) a
noArg (DumpBuildInfo -> Flag DumpBuildInfo
forall a. a -> Flag a
Flag DumpBuildInfo
DumpBuildInfo) []
[String
"enable-build-info"]
String
"Enable build information generation during project building",
Flag DumpBuildInfo
-> MkOptDescr
(ConfigFlags -> Flag DumpBuildInfo)
(Flag DumpBuildInfo -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall b a. Eq b => b -> MkOptDescr (a -> b) (b -> a -> a) a
noArg (DumpBuildInfo -> Flag DumpBuildInfo
forall a. a -> Flag a
Flag DumpBuildInfo
NoDumpBuildInfo) []
[String
"disable-build-info"]
String
"Disable build information generation during project building"
]
,String
-> [String]
-> String
-> (ConfigFlags -> Flag Bool)
-> (Flag Bool -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"library-for-ghci"]
String
"compile library for use with GHCi"
ConfigFlags -> Flag Bool
configGHCiLib (\Flag Bool
v ConfigFlags
flags -> ConfigFlags
flags { configGHCiLib = v })
(String
-> String
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall a.
String
-> String -> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
boolOpt [] [])
,String
-> [String]
-> String
-> (ConfigFlags -> Flag Bool)
-> (Flag Bool -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"split-sections"]
String
"compile library code such that unneeded definitions can be dropped from the final executable (GHC 7.8+)"
ConfigFlags -> Flag Bool
configSplitSections (\Flag Bool
v ConfigFlags
flags -> ConfigFlags
flags { configSplitSections = v })
(String
-> String
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall a.
String
-> String -> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
boolOpt [] [])
,String
-> [String]
-> String
-> (ConfigFlags -> Flag Bool)
-> (Flag Bool -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"split-objs"]
String
"split library into smaller objects to reduce binary sizes (GHC 6.6+)"
ConfigFlags -> Flag Bool
configSplitObjs (\Flag Bool
v ConfigFlags
flags -> ConfigFlags
flags { configSplitObjs = v })
(String
-> String
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall a.
String
-> String -> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
boolOpt [] [])
,String
-> [String]
-> String
-> (ConfigFlags -> Flag Bool)
-> (Flag Bool -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"executable-stripping"]
String
"strip executables upon installation to reduce binary sizes"
ConfigFlags -> Flag Bool
configStripExes (\Flag Bool
v ConfigFlags
flags -> ConfigFlags
flags { configStripExes = v })
(String
-> String
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall a.
String
-> String -> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
boolOpt [] [])
,String
-> [String]
-> String
-> (ConfigFlags -> Flag Bool)
-> (Flag Bool -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"library-stripping"]
String
"strip libraries upon installation to reduce binary sizes"
ConfigFlags -> Flag Bool
configStripLibs (\Flag Bool
v ConfigFlags
flags -> ConfigFlags
flags { configStripLibs = v })
(String
-> String
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall a.
String
-> String -> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
boolOpt [] [])
,String
-> [String]
-> String
-> (ConfigFlags -> [String])
-> ([String] -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> [String])
([String] -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"configure-option"]
String
"Extra option for configure"
ConfigFlags -> [String]
configConfigureArgs (\[String]
v ConfigFlags
flags -> ConfigFlags
flags { configConfigureArgs = v })
(String
-> (String -> [String])
-> ([String] -> [String])
-> MkOptDescr
(ConfigFlags -> [String])
([String] -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall b a.
Monoid b =>
String
-> (String -> b)
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg' String
"OPT" (\String
x -> [String
x]) [String] -> [String]
forall a. a -> a
id)
,String
-> [String]
-> String
-> (ConfigFlags -> Flag Bool)
-> (Flag Bool -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"user-install"]
String
"doing a per-user installation"
ConfigFlags -> Flag Bool
configUserInstall (\Flag Bool
v ConfigFlags
flags -> ConfigFlags
flags { configUserInstall = v })
((String, [String])
-> (String, [String])
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall a.
(String, [String])
-> (String, [String])
-> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
boolOpt' ([],[String
"user"]) ([], [String
"global"]))
,String
-> [String]
-> String
-> (ConfigFlags -> [Maybe PackageDB])
-> ([Maybe PackageDB] -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> [Maybe PackageDB])
([Maybe PackageDB] -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"package-db"]
( String
"Append the given package database to the list of package"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" databases used (to satisfy dependencies and register into)."
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" May be a specific file, 'global' or 'user'. The initial list"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" is ['global'], ['global', 'user'], or ['global', $sandbox],"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" depending on context. Use 'clear' to reset the list to empty."
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" See the user guide for details.")
ConfigFlags -> [Maybe PackageDB]
configPackageDBs (\[Maybe PackageDB]
v ConfigFlags
flags -> ConfigFlags
flags { configPackageDBs = v })
(String
-> (String -> [Maybe PackageDB])
-> ([Maybe PackageDB] -> [String])
-> MkOptDescr
(ConfigFlags -> [Maybe PackageDB])
([Maybe PackageDB] -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall b a.
Monoid b =>
String
-> (String -> b)
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg' String
"DB" String -> [Maybe PackageDB]
readPackageDbList [Maybe PackageDB] -> [String]
showPackageDbList)
,String
-> [String]
-> String
-> (ConfigFlags -> FlagAssignment)
-> (FlagAssignment -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> FlagAssignment)
(FlagAssignment -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"f" [String
"flags"]
String
"Force values for the given flags in Cabal conditionals in the .cabal file. E.g., --flags=\"debug -usebytestrings\" forces the flag \"debug\" to true and \"usebytestrings\" to false."
ConfigFlags -> FlagAssignment
configConfigurationsFlags (\FlagAssignment
v ConfigFlags
flags -> ConfigFlags
flags { configConfigurationsFlags = v })
(String
-> ReadE FlagAssignment
-> (FlagAssignment -> [String])
-> MkOptDescr
(ConfigFlags -> FlagAssignment)
(FlagAssignment -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall b a.
Monoid b =>
String
-> ReadE b
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg String
"FLAGS"
((String -> String)
-> ParsecParser FlagAssignment -> ReadE FlagAssignment
forall a. (String -> String) -> ParsecParser a -> ReadE a
parsecToReadE (\String
err -> String
"Invalid flag assignment: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
err) ParsecParser FlagAssignment
forall (m :: * -> *). CabalParsing m => m FlagAssignment
legacyParsecFlagAssignment)
FlagAssignment -> [String]
legacyShowFlagAssignment')
,String
-> [String]
-> String
-> (ConfigFlags -> [String])
-> ([String] -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> [String])
([String] -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"extra-include-dirs"]
String
"A list of directories to search for header files"
ConfigFlags -> [String]
configExtraIncludeDirs (\[String]
v ConfigFlags
flags -> ConfigFlags
flags {configExtraIncludeDirs = v})
(String
-> (String -> [String])
-> ([String] -> [String])
-> MkOptDescr
(ConfigFlags -> [String])
([String] -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall b a.
Monoid b =>
String
-> (String -> b)
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg' String
"PATH" (\String
x -> [String
x]) [String] -> [String]
forall a. a -> a
id)
,String
-> [String]
-> String
-> (ConfigFlags -> Flag Bool)
-> (Flag Bool -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"deterministic"]
String
"Try to be as deterministic as possible (used by the test suite)"
ConfigFlags -> Flag Bool
configDeterministic (\Flag Bool
v ConfigFlags
flags -> ConfigFlags
flags {configDeterministic = v})
(String
-> String
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall a.
String
-> String -> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
boolOpt [] [])
,String
-> [String]
-> String
-> (ConfigFlags -> Flag String)
-> (Flag String -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag String)
(Flag String -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"ipid"]
String
"Installed package ID to compile this package as"
ConfigFlags -> Flag String
configIPID (\Flag String
v ConfigFlags
flags -> ConfigFlags
flags {configIPID = v})
(String
-> MkOptDescr
(ConfigFlags -> Flag String)
(Flag String -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
"IPID")
,String
-> [String]
-> String
-> (ConfigFlags -> Flag String)
-> (Flag String -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag String)
(Flag String -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"cid"]
String
"Installed component ID to compile this component as"
((ComponentId -> String) -> Flag ComponentId -> Flag String
forall a b. (a -> b) -> Flag a -> Flag b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ComponentId -> String
forall a. Pretty a => a -> String
prettyShow (Flag ComponentId -> Flag String)
-> (ConfigFlags -> Flag ComponentId) -> ConfigFlags -> Flag String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ConfigFlags -> Flag ComponentId
configCID) (\Flag String
v ConfigFlags
flags -> ConfigFlags
flags {configCID = fmap mkComponentId v})
(String
-> MkOptDescr
(ConfigFlags -> Flag String)
(Flag String -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
"CID")
,String
-> [String]
-> String
-> (ConfigFlags -> [String])
-> ([String] -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> [String])
([String] -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"extra-lib-dirs"]
String
"A list of directories to search for external libraries"
ConfigFlags -> [String]
configExtraLibDirs (\[String]
v ConfigFlags
flags -> ConfigFlags
flags {configExtraLibDirs = v})
(String
-> (String -> [String])
-> ([String] -> [String])
-> MkOptDescr
(ConfigFlags -> [String])
([String] -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall b a.
Monoid b =>
String
-> (String -> b)
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg' String
"PATH" (\String
x -> [String
x]) [String] -> [String]
forall a. a -> a
id)
,String
-> [String]
-> String
-> (ConfigFlags -> [String])
-> ([String] -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> [String])
([String] -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"extra-lib-dirs-static"]
String
"A list of directories to search for external libraries when linking fully static executables"
ConfigFlags -> [String]
configExtraLibDirsStatic (\[String]
v ConfigFlags
flags -> ConfigFlags
flags {configExtraLibDirsStatic = v})
(String
-> (String -> [String])
-> ([String] -> [String])
-> MkOptDescr
(ConfigFlags -> [String])
([String] -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall b a.
Monoid b =>
String
-> (String -> b)
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg' String
"PATH" (\String
x -> [String
x]) [String] -> [String]
forall a. a -> a
id)
,String
-> [String]
-> String
-> (ConfigFlags -> [String])
-> ([String] -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> [String])
([String] -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"extra-framework-dirs"]
String
"A list of directories to search for external frameworks (OS X only)"
ConfigFlags -> [String]
configExtraFrameworkDirs
(\[String]
v ConfigFlags
flags -> ConfigFlags
flags {configExtraFrameworkDirs = v})
(String
-> (String -> [String])
-> ([String] -> [String])
-> MkOptDescr
(ConfigFlags -> [String])
([String] -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall b a.
Monoid b =>
String
-> (String -> b)
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg' String
"PATH" (\String
x -> [String
x]) [String] -> [String]
forall a. a -> a
id)
,String
-> [String]
-> String
-> (ConfigFlags -> NubList String)
-> (NubList String -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> NubList String)
(NubList String -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"extra-prog-path"]
String
"A list of directories to search for required programs (in addition to the normal search locations)"
ConfigFlags -> NubList String
configProgramPathExtra (\NubList String
v ConfigFlags
flags -> ConfigFlags
flags {configProgramPathExtra = v})
(String
-> (String -> NubList String)
-> (NubList String -> [String])
-> MkOptDescr
(ConfigFlags -> NubList String)
(NubList String -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall b a.
Monoid b =>
String
-> (String -> b)
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg' String
"PATH" (\String
x -> [String] -> NubList String
forall a. Ord a => [a] -> NubList a
toNubList [String
x]) NubList String -> [String]
forall a. NubList a -> [a]
fromNubList)
,String
-> [String]
-> String
-> (ConfigFlags -> [PackageVersionConstraint])
-> ([PackageVersionConstraint] -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> [PackageVersionConstraint])
([PackageVersionConstraint] -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"constraint"]
String
"A list of additional constraints on the dependencies."
ConfigFlags -> [PackageVersionConstraint]
configConstraints (\[PackageVersionConstraint]
v ConfigFlags
flags -> ConfigFlags
flags { configConstraints = v})
(String
-> ReadE [PackageVersionConstraint]
-> ([PackageVersionConstraint] -> [String])
-> MkOptDescr
(ConfigFlags -> [PackageVersionConstraint])
([PackageVersionConstraint] -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall b a.
Monoid b =>
String
-> ReadE b
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg String
"DEPENDENCY"
((String -> String)
-> ParsecParser [PackageVersionConstraint]
-> ReadE [PackageVersionConstraint]
forall a. (String -> String) -> ParsecParser a -> ReadE a
parsecToReadE (String -> String -> String
forall a b. a -> b -> a
const String
"dependency expected") ((\PackageVersionConstraint
x -> [PackageVersionConstraint
x]) (PackageVersionConstraint -> [PackageVersionConstraint])
-> ParsecParser PackageVersionConstraint
-> ParsecParser [PackageVersionConstraint]
forall a b. (a -> b) -> ParsecParser a -> ParsecParser b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` ParsecParser PackageVersionConstraint
forall a (m :: * -> *). (Parsec a, CabalParsing m) => m a
forall (m :: * -> *). CabalParsing m => m PackageVersionConstraint
parsec))
((PackageVersionConstraint -> String)
-> [PackageVersionConstraint] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map PackageVersionConstraint -> String
forall a. Pretty a => a -> String
prettyShow))
,String
-> [String]
-> String
-> (ConfigFlags -> [GivenComponent])
-> ([GivenComponent] -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> [GivenComponent])
([GivenComponent] -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"dependency"]
String
"A list of exact dependencies. E.g., --dependency=\"void=void-0.5.8-177d5cdf20962d0581fe2e4932a6c309\""
ConfigFlags -> [GivenComponent]
configDependencies (\[GivenComponent]
v ConfigFlags
flags -> ConfigFlags
flags { configDependencies = v})
(String
-> ReadE [GivenComponent]
-> ([GivenComponent] -> [String])
-> MkOptDescr
(ConfigFlags -> [GivenComponent])
([GivenComponent] -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall b a.
Monoid b =>
String
-> ReadE b
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg String
"NAME[:COMPONENT_NAME]=CID"
((String -> String)
-> ParsecParser [GivenComponent] -> ReadE [GivenComponent]
forall a. (String -> String) -> ParsecParser a -> ReadE a
parsecToReadE (String -> String -> String
forall a b. a -> b -> a
const String
"dependency expected") ((\GivenComponent
x -> [GivenComponent
x]) (GivenComponent -> [GivenComponent])
-> ParsecParser GivenComponent -> ParsecParser [GivenComponent]
forall a b. (a -> b) -> ParsecParser a -> ParsecParser b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
`fmap` ParsecParser GivenComponent
parsecGivenComponent))
((GivenComponent -> String) -> [GivenComponent] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map (\(GivenComponent PackageName
pn LibraryName
cn ComponentId
cid) ->
PackageName -> String
forall a. Pretty a => a -> String
prettyShow PackageName
pn
String -> String -> String
forall a. [a] -> [a] -> [a]
++ case LibraryName
cn of LibraryName
LMainLibName -> String
""
LSubLibName UnqualComponentName
n -> String
":" String -> String -> String
forall a. [a] -> [a] -> [a]
++ UnqualComponentName -> String
forall a. Pretty a => a -> String
prettyShow UnqualComponentName
n
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"=" String -> String -> String
forall a. [a] -> [a] -> [a]
++ ComponentId -> String
forall a. Pretty a => a -> String
prettyShow ComponentId
cid)))
,String
-> [String]
-> String
-> (ConfigFlags -> [(ModuleName, Module)])
-> ([(ModuleName, Module)] -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> [(ModuleName, Module)])
([(ModuleName, Module)] -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"instantiate-with"]
String
"A mapping of signature names to concrete module instantiations."
ConfigFlags -> [(ModuleName, Module)]
configInstantiateWith (\[(ModuleName, Module)]
v ConfigFlags
flags -> ConfigFlags
flags { configInstantiateWith = v })
(String
-> ReadE [(ModuleName, Module)]
-> ([(ModuleName, Module)] -> [String])
-> MkOptDescr
(ConfigFlags -> [(ModuleName, Module)])
([(ModuleName, Module)] -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall b a.
Monoid b =>
String
-> ReadE b
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg String
"NAME=MOD"
((String -> String)
-> ParsecParser [(ModuleName, Module)]
-> ReadE [(ModuleName, Module)]
forall a. (String -> String) -> ParsecParser a -> ReadE a
parsecToReadE (String
"Cannot parse module substitution: " String -> String -> String
forall a. [a] -> [a] -> [a]
++) (((ModuleName, Module) -> [(ModuleName, Module)])
-> ParsecParser (ModuleName, Module)
-> ParsecParser [(ModuleName, Module)]
forall a b. (a -> b) -> ParsecParser a -> ParsecParser b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((ModuleName, Module)
-> [(ModuleName, Module)] -> [(ModuleName, Module)]
forall a. a -> [a] -> [a]
:[]) ParsecParser (ModuleName, Module)
parsecModSubstEntry))
(((ModuleName, Module) -> String)
-> [(ModuleName, Module)] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map (Style -> Doc -> String
Disp.renderStyle Style
defaultStyle (Doc -> String)
-> ((ModuleName, Module) -> Doc) -> (ModuleName, Module) -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ModuleName, Module) -> Doc
dispModSubstEntry)))
,String
-> [String]
-> String
-> (ConfigFlags -> Flag Bool)
-> (Flag Bool -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"tests"]
String
"dependency checking and compilation for test suites listed in the package description file."
ConfigFlags -> Flag Bool
configTests (\Flag Bool
v ConfigFlags
flags -> ConfigFlags
flags { configTests = v })
(String
-> String
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall a.
String
-> String -> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
boolOpt [] [])
,String
-> [String]
-> String
-> (ConfigFlags -> Flag Bool)
-> (Flag Bool -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"coverage"]
String
"build package with Haskell Program Coverage. (GHC only)"
ConfigFlags -> Flag Bool
configCoverage (\Flag Bool
v ConfigFlags
flags -> ConfigFlags
flags { configCoverage = v })
(String
-> String
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall a.
String
-> String -> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
boolOpt [] [])
,String
-> [String]
-> String
-> (ConfigFlags -> Flag Bool)
-> (Flag Bool -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"library-coverage"]
String
"build package with Haskell Program Coverage. (GHC only) (DEPRECATED)"
ConfigFlags -> Flag Bool
configLibCoverage (\Flag Bool
v ConfigFlags
flags -> ConfigFlags
flags { configLibCoverage = v })
(String
-> String
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall a.
String
-> String -> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
boolOpt [] [])
,String
-> [String]
-> String
-> (ConfigFlags -> Flag Bool)
-> (Flag Bool -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"exact-configuration"]
String
"All direct dependencies and flags are provided on the command line."
ConfigFlags -> Flag Bool
configExactConfiguration
(\Flag Bool
v ConfigFlags
flags -> ConfigFlags
flags { configExactConfiguration = v })
MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (ConfigFlags -> Flag Bool)
-> (Flag Bool -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"benchmarks"]
String
"dependency checking and compilation for benchmarks listed in the package description file."
ConfigFlags -> Flag Bool
configBenchmarks (\Flag Bool
v ConfigFlags
flags -> ConfigFlags
flags { configBenchmarks = v })
(String
-> String
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall a.
String
-> String -> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
boolOpt [] [])
,String
-> [String]
-> String
-> (ConfigFlags -> Flag Bool)
-> (Flag Bool -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"relocatable"]
String
"building a package that is relocatable. (GHC only)"
ConfigFlags -> Flag Bool
configRelocatable (\Flag Bool
v ConfigFlags
flags -> ConfigFlags
flags { configRelocatable = v})
(String
-> String
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall a.
String
-> String -> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
boolOpt [] [])
,String
-> [String]
-> String
-> (ConfigFlags -> Flag Bool)
-> (Flag Bool -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"response-files"]
String
"enable workaround for old versions of programs like \"ar\" that do not support @file arguments"
ConfigFlags -> Flag Bool
configUseResponseFiles
(\Flag Bool
v ConfigFlags
flags -> ConfigFlags
flags { configUseResponseFiles = v })
((String, [String])
-> (String, [String])
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall a.
(String, [String])
-> (String, [String])
-> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
boolOpt' ([], [String
"disable-response-files"]) ([], []))
,String
-> [String]
-> String
-> (ConfigFlags -> Flag Bool)
-> (Flag Bool -> ConfigFlags -> ConfigFlags)
-> MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
-> OptionField ConfigFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"allow-depending-on-private-libs"]
( String
"Allow depending on private libraries. "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"If set, the library visibility check MUST be done externally." )
ConfigFlags -> Flag Bool
configAllowDependingOnPrivateLibs
(\Flag Bool
v ConfigFlags
flags -> ConfigFlags
flags { configAllowDependingOnPrivateLibs = v })
MkOptDescr
(ConfigFlags -> Flag Bool)
(Flag Bool -> ConfigFlags -> ConfigFlags)
ConfigFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
]
where
liftInstallDirs :: OptionField (InstallDirs (Flag PathTemplate))
-> OptionField ConfigFlags
liftInstallDirs =
(ConfigFlags -> InstallDirs (Flag PathTemplate))
-> (InstallDirs (Flag PathTemplate) -> ConfigFlags -> ConfigFlags)
-> OptionField (InstallDirs (Flag PathTemplate))
-> OptionField ConfigFlags
forall b a.
(b -> a) -> (a -> b -> b) -> OptionField a -> OptionField b
liftOption ConfigFlags -> InstallDirs (Flag PathTemplate)
configInstallDirs (\InstallDirs (Flag PathTemplate)
v ConfigFlags
flags -> ConfigFlags
flags { configInstallDirs = v })
reqPathTemplateArgFlag :: String
-> String
-> [String]
-> String
-> (b -> Flag PathTemplate)
-> (Flag PathTemplate -> b -> b)
-> OptDescr b
reqPathTemplateArgFlag String
title String
_sf [String]
_lf String
d b -> Flag PathTemplate
get Flag PathTemplate -> b -> b
set =
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
title String
_sf [String]
_lf String
d
((PathTemplate -> String) -> Flag PathTemplate -> Flag String
forall a b. (a -> b) -> Flag a -> Flag b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap PathTemplate -> String
fromPathTemplate (Flag PathTemplate -> Flag String)
-> (b -> Flag PathTemplate) -> b -> Flag String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. b -> Flag PathTemplate
get) (Flag PathTemplate -> b -> b
set (Flag PathTemplate -> b -> b)
-> (Flag String -> Flag PathTemplate) -> Flag String -> b -> b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (String -> PathTemplate) -> Flag String -> Flag PathTemplate
forall a b. (a -> b) -> Flag a -> Flag b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> PathTemplate
toPathTemplate)
readPackageDbList :: String -> [Maybe PackageDB]
readPackageDbList :: String -> [Maybe PackageDB]
readPackageDbList String
str = [String -> Maybe PackageDB
readPackageDb String
str]
readPackageDb :: String -> Maybe PackageDB
readPackageDb :: String -> Maybe PackageDB
readPackageDb String
"clear" = Maybe PackageDB
forall a. Maybe a
Nothing
readPackageDb String
"global" = PackageDB -> Maybe PackageDB
forall a. a -> Maybe a
Just PackageDB
GlobalPackageDB
readPackageDb String
"user" = PackageDB -> Maybe PackageDB
forall a. a -> Maybe a
Just PackageDB
UserPackageDB
readPackageDb String
other = PackageDB -> Maybe PackageDB
forall a. a -> Maybe a
Just (String -> PackageDB
SpecificPackageDB String
other)
showPackageDbList :: [Maybe PackageDB] -> [String]
showPackageDbList :: [Maybe PackageDB] -> [String]
showPackageDbList = (Maybe PackageDB -> String) -> [Maybe PackageDB] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map Maybe PackageDB -> String
showPackageDb
showPackageDb :: Maybe PackageDB -> String
showPackageDb :: Maybe PackageDB -> String
showPackageDb Maybe PackageDB
Nothing = String
"clear"
showPackageDb (Just PackageDB
GlobalPackageDB) = String
"global"
showPackageDb (Just PackageDB
UserPackageDB) = String
"user"
showPackageDb (Just (SpecificPackageDB String
db)) = String
db
showProfDetailLevelFlag :: Flag ProfDetailLevel -> [String]
showProfDetailLevelFlag :: Flag ProfDetailLevel -> [String]
showProfDetailLevelFlag Flag ProfDetailLevel
NoFlag = []
showProfDetailLevelFlag (Flag ProfDetailLevel
dl) = [ProfDetailLevel -> String
showProfDetailLevel ProfDetailLevel
dl]
parsecGivenComponent :: ParsecParser GivenComponent
parsecGivenComponent :: ParsecParser GivenComponent
parsecGivenComponent = do
PackageName
pn <- ParsecParser PackageName
forall a (m :: * -> *). (Parsec a, CabalParsing m) => m a
forall (m :: * -> *). CabalParsing m => m PackageName
parsec
LibraryName
ln <- LibraryName -> ParsecParser LibraryName -> ParsecParser LibraryName
forall (m :: * -> *) a. Alternative m => a -> m a -> m a
P.option LibraryName
LMainLibName (ParsecParser LibraryName -> ParsecParser LibraryName)
-> ParsecParser LibraryName -> ParsecParser LibraryName
forall a b. (a -> b) -> a -> b
$ do
Char
_ <- Char -> ParsecParser Char
forall (m :: * -> *). CharParsing m => Char -> m Char
P.char Char
':'
UnqualComponentName
ucn <- ParsecParser UnqualComponentName
forall a (m :: * -> *). (Parsec a, CabalParsing m) => m a
forall (m :: * -> *). CabalParsing m => m UnqualComponentName
parsec
LibraryName -> ParsecParser LibraryName
forall a. a -> ParsecParser a
forall (m :: * -> *) a. Monad m => a -> m a
return (LibraryName -> ParsecParser LibraryName)
-> LibraryName -> ParsecParser LibraryName
forall a b. (a -> b) -> a -> b
$ if UnqualComponentName -> String
unUnqualComponentName UnqualComponentName
ucn String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== PackageName -> String
unPackageName PackageName
pn
then LibraryName
LMainLibName
else UnqualComponentName -> LibraryName
LSubLibName UnqualComponentName
ucn
Char
_ <- Char -> ParsecParser Char
forall (m :: * -> *). CharParsing m => Char -> m Char
P.char Char
'='
ComponentId
cid <- ParsecParser ComponentId
forall a (m :: * -> *). (Parsec a, CabalParsing m) => m a
forall (m :: * -> *). CabalParsing m => m ComponentId
parsec
GivenComponent -> ParsecParser GivenComponent
forall a. a -> ParsecParser a
forall (m :: * -> *) a. Monad m => a -> m a
return (GivenComponent -> ParsecParser GivenComponent)
-> GivenComponent -> ParsecParser GivenComponent
forall a b. (a -> b) -> a -> b
$ PackageName -> LibraryName -> ComponentId -> GivenComponent
GivenComponent PackageName
pn LibraryName
ln ComponentId
cid
installDirsOptions :: [OptionField (InstallDirs (Flag PathTemplate))]
installDirsOptions :: [OptionField (InstallDirs (Flag PathTemplate))]
installDirsOptions =
[ String
-> [String]
-> String
-> (InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
-> (Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
-> MkOptDescr
(InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
(Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
(InstallDirs (Flag PathTemplate))
-> OptionField (InstallDirs (Flag PathTemplate))
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"prefix"]
String
"bake this prefix in preparation of installation"
InstallDirs (Flag PathTemplate) -> Flag PathTemplate
forall dir. InstallDirs dir -> dir
prefix (\Flag PathTemplate
v InstallDirs (Flag PathTemplate)
flags -> InstallDirs (Flag PathTemplate)
flags { prefix = v })
MkOptDescr
(InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
(Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
(InstallDirs (Flag PathTemplate))
forall {b}.
String
-> [String]
-> String
-> (b -> Flag PathTemplate)
-> (Flag PathTemplate -> b -> b)
-> OptDescr b
installDirArg
, String
-> [String]
-> String
-> (InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
-> (Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
-> MkOptDescr
(InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
(Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
(InstallDirs (Flag PathTemplate))
-> OptionField (InstallDirs (Flag PathTemplate))
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"bindir"]
String
"installation directory for executables"
InstallDirs (Flag PathTemplate) -> Flag PathTemplate
forall dir. InstallDirs dir -> dir
bindir (\Flag PathTemplate
v InstallDirs (Flag PathTemplate)
flags -> InstallDirs (Flag PathTemplate)
flags { bindir = v })
MkOptDescr
(InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
(Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
(InstallDirs (Flag PathTemplate))
forall {b}.
String
-> [String]
-> String
-> (b -> Flag PathTemplate)
-> (Flag PathTemplate -> b -> b)
-> OptDescr b
installDirArg
, String
-> [String]
-> String
-> (InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
-> (Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
-> MkOptDescr
(InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
(Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
(InstallDirs (Flag PathTemplate))
-> OptionField (InstallDirs (Flag PathTemplate))
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"libdir"]
String
"installation directory for libraries"
InstallDirs (Flag PathTemplate) -> Flag PathTemplate
forall dir. InstallDirs dir -> dir
libdir (\Flag PathTemplate
v InstallDirs (Flag PathTemplate)
flags -> InstallDirs (Flag PathTemplate)
flags { libdir = v })
MkOptDescr
(InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
(Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
(InstallDirs (Flag PathTemplate))
forall {b}.
String
-> [String]
-> String
-> (b -> Flag PathTemplate)
-> (Flag PathTemplate -> b -> b)
-> OptDescr b
installDirArg
, String
-> [String]
-> String
-> (InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
-> (Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
-> MkOptDescr
(InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
(Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
(InstallDirs (Flag PathTemplate))
-> OptionField (InstallDirs (Flag PathTemplate))
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"libsubdir"]
String
"subdirectory of libdir in which libs are installed"
InstallDirs (Flag PathTemplate) -> Flag PathTemplate
forall dir. InstallDirs dir -> dir
libsubdir (\Flag PathTemplate
v InstallDirs (Flag PathTemplate)
flags -> InstallDirs (Flag PathTemplate)
flags { libsubdir = v })
MkOptDescr
(InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
(Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
(InstallDirs (Flag PathTemplate))
forall {b}.
String
-> [String]
-> String
-> (b -> Flag PathTemplate)
-> (Flag PathTemplate -> b -> b)
-> OptDescr b
installDirArg
, String
-> [String]
-> String
-> (InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
-> (Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
-> MkOptDescr
(InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
(Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
(InstallDirs (Flag PathTemplate))
-> OptionField (InstallDirs (Flag PathTemplate))
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"dynlibdir"]
String
"installation directory for dynamic libraries"
InstallDirs (Flag PathTemplate) -> Flag PathTemplate
forall dir. InstallDirs dir -> dir
dynlibdir (\Flag PathTemplate
v InstallDirs (Flag PathTemplate)
flags -> InstallDirs (Flag PathTemplate)
flags { dynlibdir = v })
MkOptDescr
(InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
(Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
(InstallDirs (Flag PathTemplate))
forall {b}.
String
-> [String]
-> String
-> (b -> Flag PathTemplate)
-> (Flag PathTemplate -> b -> b)
-> OptDescr b
installDirArg
, String
-> [String]
-> String
-> (InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
-> (Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
-> MkOptDescr
(InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
(Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
(InstallDirs (Flag PathTemplate))
-> OptionField (InstallDirs (Flag PathTemplate))
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"libexecdir"]
String
"installation directory for program executables"
InstallDirs (Flag PathTemplate) -> Flag PathTemplate
forall dir. InstallDirs dir -> dir
libexecdir (\Flag PathTemplate
v InstallDirs (Flag PathTemplate)
flags -> InstallDirs (Flag PathTemplate)
flags { libexecdir = v })
MkOptDescr
(InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
(Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
(InstallDirs (Flag PathTemplate))
forall {b}.
String
-> [String]
-> String
-> (b -> Flag PathTemplate)
-> (Flag PathTemplate -> b -> b)
-> OptDescr b
installDirArg
, String
-> [String]
-> String
-> (InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
-> (Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
-> MkOptDescr
(InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
(Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
(InstallDirs (Flag PathTemplate))
-> OptionField (InstallDirs (Flag PathTemplate))
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"libexecsubdir"]
String
"subdirectory of libexecdir in which private executables are installed"
InstallDirs (Flag PathTemplate) -> Flag PathTemplate
forall dir. InstallDirs dir -> dir
libexecsubdir (\Flag PathTemplate
v InstallDirs (Flag PathTemplate)
flags -> InstallDirs (Flag PathTemplate)
flags { libexecsubdir = v })
MkOptDescr
(InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
(Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
(InstallDirs (Flag PathTemplate))
forall {b}.
String
-> [String]
-> String
-> (b -> Flag PathTemplate)
-> (Flag PathTemplate -> b -> b)
-> OptDescr b
installDirArg
, String
-> [String]
-> String
-> (InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
-> (Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
-> MkOptDescr
(InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
(Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
(InstallDirs (Flag PathTemplate))
-> OptionField (InstallDirs (Flag PathTemplate))
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"datadir"]
String
"installation directory for read-only data"
InstallDirs (Flag PathTemplate) -> Flag PathTemplate
forall dir. InstallDirs dir -> dir
datadir (\Flag PathTemplate
v InstallDirs (Flag PathTemplate)
flags -> InstallDirs (Flag PathTemplate)
flags { datadir = v })
MkOptDescr
(InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
(Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
(InstallDirs (Flag PathTemplate))
forall {b}.
String
-> [String]
-> String
-> (b -> Flag PathTemplate)
-> (Flag PathTemplate -> b -> b)
-> OptDescr b
installDirArg
, String
-> [String]
-> String
-> (InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
-> (Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
-> MkOptDescr
(InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
(Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
(InstallDirs (Flag PathTemplate))
-> OptionField (InstallDirs (Flag PathTemplate))
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"datasubdir"]
String
"subdirectory of datadir in which data files are installed"
InstallDirs (Flag PathTemplate) -> Flag PathTemplate
forall dir. InstallDirs dir -> dir
datasubdir (\Flag PathTemplate
v InstallDirs (Flag PathTemplate)
flags -> InstallDirs (Flag PathTemplate)
flags { datasubdir = v })
MkOptDescr
(InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
(Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
(InstallDirs (Flag PathTemplate))
forall {b}.
String
-> [String]
-> String
-> (b -> Flag PathTemplate)
-> (Flag PathTemplate -> b -> b)
-> OptDescr b
installDirArg
, String
-> [String]
-> String
-> (InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
-> (Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
-> MkOptDescr
(InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
(Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
(InstallDirs (Flag PathTemplate))
-> OptionField (InstallDirs (Flag PathTemplate))
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"docdir"]
String
"installation directory for documentation"
InstallDirs (Flag PathTemplate) -> Flag PathTemplate
forall dir. InstallDirs dir -> dir
docdir (\Flag PathTemplate
v InstallDirs (Flag PathTemplate)
flags -> InstallDirs (Flag PathTemplate)
flags { docdir = v })
MkOptDescr
(InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
(Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
(InstallDirs (Flag PathTemplate))
forall {b}.
String
-> [String]
-> String
-> (b -> Flag PathTemplate)
-> (Flag PathTemplate -> b -> b)
-> OptDescr b
installDirArg
, String
-> [String]
-> String
-> (InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
-> (Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
-> MkOptDescr
(InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
(Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
(InstallDirs (Flag PathTemplate))
-> OptionField (InstallDirs (Flag PathTemplate))
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"htmldir"]
String
"installation directory for HTML documentation"
InstallDirs (Flag PathTemplate) -> Flag PathTemplate
forall dir. InstallDirs dir -> dir
htmldir (\Flag PathTemplate
v InstallDirs (Flag PathTemplate)
flags -> InstallDirs (Flag PathTemplate)
flags { htmldir = v })
MkOptDescr
(InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
(Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
(InstallDirs (Flag PathTemplate))
forall {b}.
String
-> [String]
-> String
-> (b -> Flag PathTemplate)
-> (Flag PathTemplate -> b -> b)
-> OptDescr b
installDirArg
, String
-> [String]
-> String
-> (InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
-> (Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
-> MkOptDescr
(InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
(Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
(InstallDirs (Flag PathTemplate))
-> OptionField (InstallDirs (Flag PathTemplate))
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"haddockdir"]
String
"installation directory for haddock interfaces"
InstallDirs (Flag PathTemplate) -> Flag PathTemplate
forall dir. InstallDirs dir -> dir
haddockdir (\Flag PathTemplate
v InstallDirs (Flag PathTemplate)
flags -> InstallDirs (Flag PathTemplate)
flags { haddockdir = v })
MkOptDescr
(InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
(Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
(InstallDirs (Flag PathTemplate))
forall {b}.
String
-> [String]
-> String
-> (b -> Flag PathTemplate)
-> (Flag PathTemplate -> b -> b)
-> OptDescr b
installDirArg
, String
-> [String]
-> String
-> (InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
-> (Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
-> MkOptDescr
(InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
(Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
(InstallDirs (Flag PathTemplate))
-> OptionField (InstallDirs (Flag PathTemplate))
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"sysconfdir"]
String
"installation directory for configuration files"
InstallDirs (Flag PathTemplate) -> Flag PathTemplate
forall dir. InstallDirs dir -> dir
sysconfdir (\Flag PathTemplate
v InstallDirs (Flag PathTemplate)
flags -> InstallDirs (Flag PathTemplate)
flags { sysconfdir = v })
MkOptDescr
(InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
(Flag PathTemplate
-> InstallDirs (Flag PathTemplate)
-> InstallDirs (Flag PathTemplate))
(InstallDirs (Flag PathTemplate))
forall {b}.
String
-> [String]
-> String
-> (b -> Flag PathTemplate)
-> (Flag PathTemplate -> b -> b)
-> OptDescr b
installDirArg
]
where
installDirArg :: String
-> [String]
-> String
-> (b -> Flag PathTemplate)
-> (Flag PathTemplate -> b -> b)
-> OptDescr b
installDirArg String
_sf [String]
_lf String
d b -> Flag PathTemplate
get Flag PathTemplate -> b -> b
set =
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
"DIR" String
_sf [String]
_lf String
d
((PathTemplate -> String) -> Flag PathTemplate -> Flag String
forall a b. (a -> b) -> Flag a -> Flag b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap PathTemplate -> String
fromPathTemplate (Flag PathTemplate -> Flag String)
-> (b -> Flag PathTemplate) -> b -> Flag String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. b -> Flag PathTemplate
get) (Flag PathTemplate -> b -> b
set (Flag PathTemplate -> b -> b)
-> (Flag String -> Flag PathTemplate) -> Flag String -> b -> b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (String -> PathTemplate) -> Flag String -> Flag PathTemplate
forall a b. (a -> b) -> Flag a -> Flag b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> PathTemplate
toPathTemplate)
emptyConfigFlags :: ConfigFlags
emptyConfigFlags :: ConfigFlags
emptyConfigFlags = ConfigFlags
forall a. Monoid a => a
mempty
instance Monoid ConfigFlags where
mempty :: ConfigFlags
mempty = ConfigFlags
forall a. (Generic a, GMonoid (Rep a)) => a
gmempty
mappend :: ConfigFlags -> ConfigFlags -> ConfigFlags
mappend = ConfigFlags -> ConfigFlags -> ConfigFlags
forall a. Semigroup a => a -> a -> a
(<>)
instance Semigroup ConfigFlags where
<> :: ConfigFlags -> ConfigFlags -> ConfigFlags
(<>) = ConfigFlags -> ConfigFlags -> ConfigFlags
forall a. (Generic a, GSemigroup (Rep a)) => a -> a -> a
gmappend
data CopyFlags = CopyFlags {
CopyFlags -> Flag CopyDest
copyDest :: Flag CopyDest,
CopyFlags -> Flag String
copyDistPref :: Flag FilePath,
CopyFlags -> Flag Verbosity
copyVerbosity :: Flag Verbosity,
CopyFlags -> [String]
copyArgs :: [String],
CopyFlags -> Flag String
copyCabalFilePath :: Flag FilePath
}
deriving (Int -> CopyFlags -> String -> String
[CopyFlags] -> String -> String
CopyFlags -> String
(Int -> CopyFlags -> String -> String)
-> (CopyFlags -> String)
-> ([CopyFlags] -> String -> String)
-> Show CopyFlags
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> CopyFlags -> String -> String
showsPrec :: Int -> CopyFlags -> String -> String
$cshow :: CopyFlags -> String
show :: CopyFlags -> String
$cshowList :: [CopyFlags] -> String -> String
showList :: [CopyFlags] -> String -> String
Show, (forall x. CopyFlags -> Rep CopyFlags x)
-> (forall x. Rep CopyFlags x -> CopyFlags) -> Generic CopyFlags
forall x. Rep CopyFlags x -> CopyFlags
forall x. CopyFlags -> Rep CopyFlags x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CopyFlags -> Rep CopyFlags x
from :: forall x. CopyFlags -> Rep CopyFlags x
$cto :: forall x. Rep CopyFlags x -> CopyFlags
to :: forall x. Rep CopyFlags x -> CopyFlags
Generic)
defaultCopyFlags :: CopyFlags
defaultCopyFlags :: CopyFlags
defaultCopyFlags = CopyFlags {
copyDest :: Flag CopyDest
copyDest = CopyDest -> Flag CopyDest
forall a. a -> Flag a
Flag CopyDest
NoCopyDest,
copyDistPref :: Flag String
copyDistPref = Flag String
forall a. Flag a
NoFlag,
copyVerbosity :: Flag Verbosity
copyVerbosity = Verbosity -> Flag Verbosity
forall a. a -> Flag a
Flag Verbosity
normal,
copyArgs :: [String]
copyArgs = [],
copyCabalFilePath :: Flag String
copyCabalFilePath = Flag String
forall a. Monoid a => a
mempty
}
copyCommand :: CommandUI CopyFlags
copyCommand :: CommandUI CopyFlags
copyCommand = CommandUI
{ commandName :: String
commandName = String
"copy"
, commandSynopsis :: String
commandSynopsis = String
"Copy the files of all/specific components to install locations."
, commandDescription :: Maybe (String -> String)
commandDescription = (String -> String) -> Maybe (String -> String)
forall a. a -> Maybe a
Just ((String -> String) -> Maybe (String -> String))
-> (String -> String) -> Maybe (String -> String)
forall a b. (a -> b) -> a -> b
$ \String
_ -> String -> String
wrapText (String -> String) -> String -> String
forall a b. (a -> b) -> a -> b
$
String
"Components encompass executables and libraries. "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"Does not call register, and allows a prefix at install time. "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"Without the --destdir flag, configure determines location.\n"
, commandNotes :: Maybe (String -> String)
commandNotes = (String -> String) -> Maybe (String -> String)
forall a. a -> Maybe a
Just ((String -> String) -> Maybe (String -> String))
-> (String -> String) -> Maybe (String -> String)
forall a b. (a -> b) -> a -> b
$ \String
pname ->
String
"Examples:\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
pname String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" copy "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" All the components in the package\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
pname String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" copy foo "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" A component (i.e. lib, exe, test suite)"
, commandUsage :: String -> String
commandUsage = String -> [String] -> String -> String
usageAlternatives String
"copy" ([String] -> String -> String) -> [String] -> String -> String
forall a b. (a -> b) -> a -> b
$
[ String
"[FLAGS]"
, String
"COMPONENTS [FLAGS]"
]
, commandDefaultFlags :: CopyFlags
commandDefaultFlags = CopyFlags
defaultCopyFlags
, commandOptions :: ShowOrParseArgs -> [OptionField CopyFlags]
commandOptions = \ShowOrParseArgs
showOrParseArgs -> case ShowOrParseArgs
showOrParseArgs of
ShowOrParseArgs
ShowArgs -> (OptionField CopyFlags -> Bool)
-> [OptionField CopyFlags] -> [OptionField CopyFlags]
forall a. (a -> Bool) -> [a] -> [a]
filter ((String -> [String] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`notElem` [String
"target-package-db"])
(String -> Bool)
-> (OptionField CopyFlags -> String)
-> OptionField CopyFlags
-> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OptionField CopyFlags -> String
forall a. OptionField a -> String
optionName) ([OptionField CopyFlags] -> [OptionField CopyFlags])
-> [OptionField CopyFlags] -> [OptionField CopyFlags]
forall a b. (a -> b) -> a -> b
$ ShowOrParseArgs -> [OptionField CopyFlags]
copyOptions ShowOrParseArgs
ShowArgs
ShowOrParseArgs
ParseArgs -> ShowOrParseArgs -> [OptionField CopyFlags]
copyOptions ShowOrParseArgs
ParseArgs
}
copyOptions :: ShowOrParseArgs -> [OptionField CopyFlags]
copyOptions :: ShowOrParseArgs -> [OptionField CopyFlags]
copyOptions ShowOrParseArgs
showOrParseArgs =
[(CopyFlags -> Flag Verbosity)
-> (Flag Verbosity -> CopyFlags -> CopyFlags)
-> OptionField CopyFlags
forall flags.
(flags -> Flag Verbosity)
-> (Flag Verbosity -> flags -> flags) -> OptionField flags
optionVerbosity CopyFlags -> Flag Verbosity
copyVerbosity (\Flag Verbosity
v CopyFlags
flags -> CopyFlags
flags { copyVerbosity = v })
,(CopyFlags -> Flag String)
-> (Flag String -> CopyFlags -> CopyFlags)
-> ShowOrParseArgs
-> OptionField CopyFlags
forall flags.
(flags -> Flag String)
-> (Flag String -> flags -> flags)
-> ShowOrParseArgs
-> OptionField flags
optionDistPref
CopyFlags -> Flag String
copyDistPref (\Flag String
d CopyFlags
flags -> CopyFlags
flags { copyDistPref = d })
ShowOrParseArgs
showOrParseArgs
,String
-> [String]
-> String
-> (CopyFlags -> Flag CopyDest)
-> (Flag CopyDest -> CopyFlags -> CopyFlags)
-> MkOptDescr
(CopyFlags -> Flag CopyDest)
(Flag CopyDest -> CopyFlags -> CopyFlags)
CopyFlags
-> OptionField CopyFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"destdir"]
String
"directory to copy files to, prepended to installation directories"
CopyFlags -> Flag CopyDest
copyDest (\Flag CopyDest
v CopyFlags
flags -> case CopyFlags -> Flag CopyDest
copyDest CopyFlags
flags of
Flag (CopyToDb String
_) -> String -> CopyFlags
forall a. HasCallStack => String -> a
error String
"Use either 'destdir' or 'target-package-db'."
Flag CopyDest
_ -> CopyFlags
flags { copyDest = v })
(String
-> ReadE (Flag CopyDest)
-> (Flag CopyDest -> [String])
-> MkOptDescr
(CopyFlags -> Flag CopyDest)
(Flag CopyDest -> CopyFlags -> CopyFlags)
CopyFlags
forall b a.
Monoid b =>
String
-> ReadE b
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg String
"DIR" ((String -> Flag CopyDest) -> ReadE (Flag CopyDest)
forall a. (String -> a) -> ReadE a
succeedReadE (CopyDest -> Flag CopyDest
forall a. a -> Flag a
Flag (CopyDest -> Flag CopyDest)
-> (String -> CopyDest) -> String -> Flag CopyDest
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> CopyDest
CopyTo))
(\Flag CopyDest
f -> case Flag CopyDest
f of Flag (CopyTo String
p) -> [String
p]; Flag CopyDest
_ -> []))
,String
-> [String]
-> String
-> (CopyFlags -> Flag CopyDest)
-> (Flag CopyDest -> CopyFlags -> CopyFlags)
-> MkOptDescr
(CopyFlags -> Flag CopyDest)
(Flag CopyDest -> CopyFlags -> CopyFlags)
CopyFlags
-> OptionField CopyFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"target-package-db"]
String
"package database to copy files into. Required when using ${pkgroot} prefix."
CopyFlags -> Flag CopyDest
copyDest (\Flag CopyDest
v CopyFlags
flags -> case CopyFlags -> Flag CopyDest
copyDest CopyFlags
flags of
Flag CopyDest
NoFlag -> CopyFlags
flags { copyDest = v }
Flag CopyDest
NoCopyDest -> CopyFlags
flags { copyDest = v }
Flag CopyDest
_ -> String -> CopyFlags
forall a. HasCallStack => String -> a
error String
"Use either 'destdir' or 'target-package-db'.")
(String
-> ReadE (Flag CopyDest)
-> (Flag CopyDest -> [String])
-> MkOptDescr
(CopyFlags -> Flag CopyDest)
(Flag CopyDest -> CopyFlags -> CopyFlags)
CopyFlags
forall b a.
Monoid b =>
String
-> ReadE b
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg String
"DATABASE" ((String -> Flag CopyDest) -> ReadE (Flag CopyDest)
forall a. (String -> a) -> ReadE a
succeedReadE (CopyDest -> Flag CopyDest
forall a. a -> Flag a
Flag (CopyDest -> Flag CopyDest)
-> (String -> CopyDest) -> String -> Flag CopyDest
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> CopyDest
CopyToDb))
(\Flag CopyDest
f -> case Flag CopyDest
f of Flag (CopyToDb String
p) -> [String
p]; Flag CopyDest
_ -> []))
]
emptyCopyFlags :: CopyFlags
emptyCopyFlags :: CopyFlags
emptyCopyFlags = CopyFlags
forall a. Monoid a => a
mempty
instance Monoid CopyFlags where
mempty :: CopyFlags
mempty = CopyFlags
forall a. (Generic a, GMonoid (Rep a)) => a
gmempty
mappend :: CopyFlags -> CopyFlags -> CopyFlags
mappend = CopyFlags -> CopyFlags -> CopyFlags
forall a. Semigroup a => a -> a -> a
(<>)
instance Semigroup CopyFlags where
<> :: CopyFlags -> CopyFlags -> CopyFlags
(<>) = CopyFlags -> CopyFlags -> CopyFlags
forall a. (Generic a, GSemigroup (Rep a)) => a -> a -> a
gmappend
data InstallFlags = InstallFlags {
InstallFlags -> Flag PackageDB
installPackageDB :: Flag PackageDB,
InstallFlags -> Flag CopyDest
installDest :: Flag CopyDest,
InstallFlags -> Flag String
installDistPref :: Flag FilePath,
InstallFlags -> Flag Bool
installUseWrapper :: Flag Bool,
InstallFlags -> Flag Bool
installInPlace :: Flag Bool,
InstallFlags -> Flag Verbosity
installVerbosity :: Flag Verbosity,
InstallFlags -> Flag String
installCabalFilePath :: Flag FilePath
}
deriving (Int -> InstallFlags -> String -> String
[InstallFlags] -> String -> String
InstallFlags -> String
(Int -> InstallFlags -> String -> String)
-> (InstallFlags -> String)
-> ([InstallFlags] -> String -> String)
-> Show InstallFlags
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> InstallFlags -> String -> String
showsPrec :: Int -> InstallFlags -> String -> String
$cshow :: InstallFlags -> String
show :: InstallFlags -> String
$cshowList :: [InstallFlags] -> String -> String
showList :: [InstallFlags] -> String -> String
Show, (forall x. InstallFlags -> Rep InstallFlags x)
-> (forall x. Rep InstallFlags x -> InstallFlags)
-> Generic InstallFlags
forall x. Rep InstallFlags x -> InstallFlags
forall x. InstallFlags -> Rep InstallFlags x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. InstallFlags -> Rep InstallFlags x
from :: forall x. InstallFlags -> Rep InstallFlags x
$cto :: forall x. Rep InstallFlags x -> InstallFlags
to :: forall x. Rep InstallFlags x -> InstallFlags
Generic)
defaultInstallFlags :: InstallFlags
defaultInstallFlags :: InstallFlags
defaultInstallFlags = InstallFlags {
installPackageDB :: Flag PackageDB
installPackageDB = Flag PackageDB
forall a. Flag a
NoFlag,
installDest :: Flag CopyDest
installDest = CopyDest -> Flag CopyDest
forall a. a -> Flag a
Flag CopyDest
NoCopyDest,
installDistPref :: Flag String
installDistPref = Flag String
forall a. Flag a
NoFlag,
installUseWrapper :: Flag Bool
installUseWrapper = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
installInPlace :: Flag Bool
installInPlace = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
installVerbosity :: Flag Verbosity
installVerbosity = Verbosity -> Flag Verbosity
forall a. a -> Flag a
Flag Verbosity
normal,
installCabalFilePath :: Flag String
installCabalFilePath = Flag String
forall a. Monoid a => a
mempty
}
installCommand :: CommandUI InstallFlags
installCommand :: CommandUI InstallFlags
installCommand = CommandUI
{ commandName :: String
commandName = String
"install"
, commandSynopsis :: String
commandSynopsis =
String
"Copy the files into the install locations. Run register."
, commandDescription :: Maybe (String -> String)
commandDescription = (String -> String) -> Maybe (String -> String)
forall a. a -> Maybe a
Just ((String -> String) -> Maybe (String -> String))
-> (String -> String) -> Maybe (String -> String)
forall a b. (a -> b) -> a -> b
$ \String
_ -> String -> String
wrapText (String -> String) -> String -> String
forall a b. (a -> b) -> a -> b
$
String
"Unlike the copy command, install calls the register command."
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"If you want to install into a location that is not what was"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"specified in the configure step, use the copy command.\n"
, commandNotes :: Maybe (String -> String)
commandNotes = Maybe (String -> String)
forall a. Maybe a
Nothing
, commandUsage :: String -> String
commandUsage = \String
pname ->
String
"Usage: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
pname String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" install [FLAGS]\n"
, commandDefaultFlags :: InstallFlags
commandDefaultFlags = InstallFlags
defaultInstallFlags
, commandOptions :: ShowOrParseArgs -> [OptionField InstallFlags]
commandOptions = \ShowOrParseArgs
showOrParseArgs -> case ShowOrParseArgs
showOrParseArgs of
ShowOrParseArgs
ShowArgs -> (OptionField InstallFlags -> Bool)
-> [OptionField InstallFlags] -> [OptionField InstallFlags]
forall a. (a -> Bool) -> [a] -> [a]
filter ((String -> [String] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`notElem` [String
"target-package-db"])
(String -> Bool)
-> (OptionField InstallFlags -> String)
-> OptionField InstallFlags
-> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. OptionField InstallFlags -> String
forall a. OptionField a -> String
optionName) ([OptionField InstallFlags] -> [OptionField InstallFlags])
-> [OptionField InstallFlags] -> [OptionField InstallFlags]
forall a b. (a -> b) -> a -> b
$ ShowOrParseArgs -> [OptionField InstallFlags]
installOptions ShowOrParseArgs
ShowArgs
ShowOrParseArgs
ParseArgs -> ShowOrParseArgs -> [OptionField InstallFlags]
installOptions ShowOrParseArgs
ParseArgs
}
installOptions :: ShowOrParseArgs -> [OptionField InstallFlags]
installOptions :: ShowOrParseArgs -> [OptionField InstallFlags]
installOptions ShowOrParseArgs
showOrParseArgs =
[(InstallFlags -> Flag Verbosity)
-> (Flag Verbosity -> InstallFlags -> InstallFlags)
-> OptionField InstallFlags
forall flags.
(flags -> Flag Verbosity)
-> (Flag Verbosity -> flags -> flags) -> OptionField flags
optionVerbosity InstallFlags -> Flag Verbosity
installVerbosity (\Flag Verbosity
v InstallFlags
flags -> InstallFlags
flags { installVerbosity = v })
,(InstallFlags -> Flag String)
-> (Flag String -> InstallFlags -> InstallFlags)
-> ShowOrParseArgs
-> OptionField InstallFlags
forall flags.
(flags -> Flag String)
-> (Flag String -> flags -> flags)
-> ShowOrParseArgs
-> OptionField flags
optionDistPref
InstallFlags -> Flag String
installDistPref (\Flag String
d InstallFlags
flags -> InstallFlags
flags { installDistPref = d })
ShowOrParseArgs
showOrParseArgs
,String
-> [String]
-> String
-> (InstallFlags -> Flag Bool)
-> (Flag Bool -> InstallFlags -> InstallFlags)
-> MkOptDescr
(InstallFlags -> Flag Bool)
(Flag Bool -> InstallFlags -> InstallFlags)
InstallFlags
-> OptionField InstallFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"inplace"]
String
"install the package in the install subdirectory of the dist prefix, so it can be used without being installed"
InstallFlags -> Flag Bool
installInPlace (\Flag Bool
v InstallFlags
flags -> InstallFlags
flags { installInPlace = v })
MkOptDescr
(InstallFlags -> Flag Bool)
(Flag Bool -> InstallFlags -> InstallFlags)
InstallFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (InstallFlags -> Flag Bool)
-> (Flag Bool -> InstallFlags -> InstallFlags)
-> MkOptDescr
(InstallFlags -> Flag Bool)
(Flag Bool -> InstallFlags -> InstallFlags)
InstallFlags
-> OptionField InstallFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"shell-wrappers"]
String
"using shell script wrappers around executables"
InstallFlags -> Flag Bool
installUseWrapper (\Flag Bool
v InstallFlags
flags -> InstallFlags
flags { installUseWrapper = v })
(String
-> String
-> MkOptDescr
(InstallFlags -> Flag Bool)
(Flag Bool -> InstallFlags -> InstallFlags)
InstallFlags
forall a.
String
-> String -> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
boolOpt [] [])
,String
-> [String]
-> String
-> (InstallFlags -> Flag PackageDB)
-> (Flag PackageDB -> InstallFlags -> InstallFlags)
-> MkOptDescr
(InstallFlags -> Flag PackageDB)
(Flag PackageDB -> InstallFlags -> InstallFlags)
InstallFlags
-> OptionField InstallFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"package-db"] String
""
InstallFlags -> Flag PackageDB
installPackageDB (\Flag PackageDB
v InstallFlags
flags -> InstallFlags
flags { installPackageDB = v })
([(Flag PackageDB, (String, [String]), String)]
-> MkOptDescr
(InstallFlags -> Flag PackageDB)
(Flag PackageDB -> InstallFlags -> InstallFlags)
InstallFlags
forall b a.
Eq b =>
[(b, (String, [String]), String)]
-> MkOptDescr (a -> b) (b -> a -> a) a
choiceOpt [ (PackageDB -> Flag PackageDB
forall a. a -> Flag a
Flag PackageDB
UserPackageDB, ([],[String
"user"]),
String
"upon configuration register this package in the user's local package database")
, (PackageDB -> Flag PackageDB
forall a. a -> Flag a
Flag PackageDB
GlobalPackageDB, ([],[String
"global"]),
String
"(default) upon configuration register this package in the system-wide package database")])
,String
-> [String]
-> String
-> (InstallFlags -> Flag CopyDest)
-> (Flag CopyDest -> InstallFlags -> InstallFlags)
-> MkOptDescr
(InstallFlags -> Flag CopyDest)
(Flag CopyDest -> InstallFlags -> InstallFlags)
InstallFlags
-> OptionField InstallFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"target-package-db"]
String
"package database to install into. Required when using ${pkgroot} prefix."
InstallFlags -> Flag CopyDest
installDest (\Flag CopyDest
v InstallFlags
flags -> InstallFlags
flags { installDest = v })
(String
-> ReadE (Flag CopyDest)
-> (Flag CopyDest -> [String])
-> MkOptDescr
(InstallFlags -> Flag CopyDest)
(Flag CopyDest -> InstallFlags -> InstallFlags)
InstallFlags
forall b a.
Monoid b =>
String
-> ReadE b
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg String
"DATABASE" ((String -> Flag CopyDest) -> ReadE (Flag CopyDest)
forall a. (String -> a) -> ReadE a
succeedReadE (CopyDest -> Flag CopyDest
forall a. a -> Flag a
Flag (CopyDest -> Flag CopyDest)
-> (String -> CopyDest) -> String -> Flag CopyDest
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> CopyDest
CopyToDb))
(\Flag CopyDest
f -> case Flag CopyDest
f of Flag (CopyToDb String
p) -> [String
p]; Flag CopyDest
_ -> []))
]
emptyInstallFlags :: InstallFlags
emptyInstallFlags :: InstallFlags
emptyInstallFlags = InstallFlags
forall a. Monoid a => a
mempty
instance Monoid InstallFlags where
mempty :: InstallFlags
mempty = InstallFlags
forall a. (Generic a, GMonoid (Rep a)) => a
gmempty
mappend :: InstallFlags -> InstallFlags -> InstallFlags
mappend = InstallFlags -> InstallFlags -> InstallFlags
forall a. Semigroup a => a -> a -> a
(<>)
instance Semigroup InstallFlags where
<> :: InstallFlags -> InstallFlags -> InstallFlags
(<>) = InstallFlags -> InstallFlags -> InstallFlags
forall a. (Generic a, GSemigroup (Rep a)) => a -> a -> a
gmappend
data SDistFlags = SDistFlags {
SDistFlags -> Flag Bool
sDistSnapshot :: Flag Bool,
SDistFlags -> Flag String
sDistDirectory :: Flag FilePath,
SDistFlags -> Flag String
sDistDistPref :: Flag FilePath,
SDistFlags -> Flag String
sDistListSources :: Flag FilePath,
SDistFlags -> Flag Verbosity
sDistVerbosity :: Flag Verbosity
}
deriving (Int -> SDistFlags -> String -> String
[SDistFlags] -> String -> String
SDistFlags -> String
(Int -> SDistFlags -> String -> String)
-> (SDistFlags -> String)
-> ([SDistFlags] -> String -> String)
-> Show SDistFlags
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> SDistFlags -> String -> String
showsPrec :: Int -> SDistFlags -> String -> String
$cshow :: SDistFlags -> String
show :: SDistFlags -> String
$cshowList :: [SDistFlags] -> String -> String
showList :: [SDistFlags] -> String -> String
Show, (forall x. SDistFlags -> Rep SDistFlags x)
-> (forall x. Rep SDistFlags x -> SDistFlags) -> Generic SDistFlags
forall x. Rep SDistFlags x -> SDistFlags
forall x. SDistFlags -> Rep SDistFlags x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. SDistFlags -> Rep SDistFlags x
from :: forall x. SDistFlags -> Rep SDistFlags x
$cto :: forall x. Rep SDistFlags x -> SDistFlags
to :: forall x. Rep SDistFlags x -> SDistFlags
Generic, Typeable)
defaultSDistFlags :: SDistFlags
defaultSDistFlags :: SDistFlags
defaultSDistFlags = SDistFlags {
sDistSnapshot :: Flag Bool
sDistSnapshot = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
sDistDirectory :: Flag String
sDistDirectory = Flag String
forall a. Monoid a => a
mempty,
sDistDistPref :: Flag String
sDistDistPref = Flag String
forall a. Flag a
NoFlag,
sDistListSources :: Flag String
sDistListSources = Flag String
forall a. Monoid a => a
mempty,
sDistVerbosity :: Flag Verbosity
sDistVerbosity = Verbosity -> Flag Verbosity
forall a. a -> Flag a
Flag Verbosity
normal
}
sdistCommand :: CommandUI SDistFlags
sdistCommand :: CommandUI SDistFlags
sdistCommand = CommandUI
{ commandName :: String
commandName = String
"sdist"
, commandSynopsis :: String
commandSynopsis =
String
"Generate a source distribution file (.tar.gz)."
, commandDescription :: Maybe (String -> String)
commandDescription = Maybe (String -> String)
forall a. Maybe a
Nothing
, commandNotes :: Maybe (String -> String)
commandNotes = Maybe (String -> String)
forall a. Maybe a
Nothing
, commandUsage :: String -> String
commandUsage = \String
pname ->
String
"Usage: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
pname String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" sdist [FLAGS]\n"
, commandDefaultFlags :: SDistFlags
commandDefaultFlags = SDistFlags
defaultSDistFlags
, commandOptions :: ShowOrParseArgs -> [OptionField SDistFlags]
commandOptions = \ShowOrParseArgs
showOrParseArgs ->
[(SDistFlags -> Flag Verbosity)
-> (Flag Verbosity -> SDistFlags -> SDistFlags)
-> OptionField SDistFlags
forall flags.
(flags -> Flag Verbosity)
-> (Flag Verbosity -> flags -> flags) -> OptionField flags
optionVerbosity SDistFlags -> Flag Verbosity
sDistVerbosity (\Flag Verbosity
v SDistFlags
flags -> SDistFlags
flags { sDistVerbosity = v })
,(SDistFlags -> Flag String)
-> (Flag String -> SDistFlags -> SDistFlags)
-> ShowOrParseArgs
-> OptionField SDistFlags
forall flags.
(flags -> Flag String)
-> (Flag String -> flags -> flags)
-> ShowOrParseArgs
-> OptionField flags
optionDistPref
SDistFlags -> Flag String
sDistDistPref (\Flag String
d SDistFlags
flags -> SDistFlags
flags { sDistDistPref = d })
ShowOrParseArgs
showOrParseArgs
,String
-> [String]
-> String
-> (SDistFlags -> Flag String)
-> (Flag String -> SDistFlags -> SDistFlags)
-> MkOptDescr
(SDistFlags -> Flag String)
(Flag String -> SDistFlags -> SDistFlags)
SDistFlags
-> OptionField SDistFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"list-sources"]
String
"Just write a list of the package's sources to a file"
SDistFlags -> Flag String
sDistListSources (\Flag String
v SDistFlags
flags -> SDistFlags
flags { sDistListSources = v })
(String
-> MkOptDescr
(SDistFlags -> Flag String)
(Flag String -> SDistFlags -> SDistFlags)
SDistFlags
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
"FILE")
,String
-> [String]
-> String
-> (SDistFlags -> Flag Bool)
-> (Flag Bool -> SDistFlags -> SDistFlags)
-> MkOptDescr
(SDistFlags -> Flag Bool)
(Flag Bool -> SDistFlags -> SDistFlags)
SDistFlags
-> OptionField SDistFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"snapshot"]
String
"Produce a snapshot source distribution"
SDistFlags -> Flag Bool
sDistSnapshot (\Flag Bool
v SDistFlags
flags -> SDistFlags
flags { sDistSnapshot = v })
MkOptDescr
(SDistFlags -> Flag Bool)
(Flag Bool -> SDistFlags -> SDistFlags)
SDistFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (SDistFlags -> Flag String)
-> (Flag String -> SDistFlags -> SDistFlags)
-> MkOptDescr
(SDistFlags -> Flag String)
(Flag String -> SDistFlags -> SDistFlags)
SDistFlags
-> OptionField SDistFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"output-directory"]
(String
"Generate a source distribution in the given directory, "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"without creating a tarball")
SDistFlags -> Flag String
sDistDirectory (\Flag String
v SDistFlags
flags -> SDistFlags
flags { sDistDirectory = v })
(String
-> MkOptDescr
(SDistFlags -> Flag String)
(Flag String -> SDistFlags -> SDistFlags)
SDistFlags
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
"DIR")
]
}
emptySDistFlags :: SDistFlags
emptySDistFlags :: SDistFlags
emptySDistFlags = SDistFlags
forall a. Monoid a => a
mempty
instance Monoid SDistFlags where
mempty :: SDistFlags
mempty = SDistFlags
forall a. (Generic a, GMonoid (Rep a)) => a
gmempty
mappend :: SDistFlags -> SDistFlags -> SDistFlags
mappend = SDistFlags -> SDistFlags -> SDistFlags
forall a. Semigroup a => a -> a -> a
(<>)
instance Semigroup SDistFlags where
<> :: SDistFlags -> SDistFlags -> SDistFlags
(<>) = SDistFlags -> SDistFlags -> SDistFlags
forall a. (Generic a, GSemigroup (Rep a)) => a -> a -> a
gmappend
data RegisterFlags = RegisterFlags {
RegisterFlags -> Flag PackageDB
regPackageDB :: Flag PackageDB,
RegisterFlags -> Flag Bool
regGenScript :: Flag Bool,
RegisterFlags -> Flag (Maybe String)
regGenPkgConf :: Flag (Maybe FilePath),
RegisterFlags -> Flag Bool
regInPlace :: Flag Bool,
RegisterFlags -> Flag String
regDistPref :: Flag FilePath,
RegisterFlags -> Flag Bool
regPrintId :: Flag Bool,
RegisterFlags -> Flag Verbosity
regVerbosity :: Flag Verbosity,
RegisterFlags -> [String]
regArgs :: [String],
RegisterFlags -> Flag String
regCabalFilePath :: Flag FilePath
}
deriving (Int -> RegisterFlags -> String -> String
[RegisterFlags] -> String -> String
RegisterFlags -> String
(Int -> RegisterFlags -> String -> String)
-> (RegisterFlags -> String)
-> ([RegisterFlags] -> String -> String)
-> Show RegisterFlags
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> RegisterFlags -> String -> String
showsPrec :: Int -> RegisterFlags -> String -> String
$cshow :: RegisterFlags -> String
show :: RegisterFlags -> String
$cshowList :: [RegisterFlags] -> String -> String
showList :: [RegisterFlags] -> String -> String
Show, (forall x. RegisterFlags -> Rep RegisterFlags x)
-> (forall x. Rep RegisterFlags x -> RegisterFlags)
-> Generic RegisterFlags
forall x. Rep RegisterFlags x -> RegisterFlags
forall x. RegisterFlags -> Rep RegisterFlags x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. RegisterFlags -> Rep RegisterFlags x
from :: forall x. RegisterFlags -> Rep RegisterFlags x
$cto :: forall x. Rep RegisterFlags x -> RegisterFlags
to :: forall x. Rep RegisterFlags x -> RegisterFlags
Generic, Typeable)
defaultRegisterFlags :: RegisterFlags
defaultRegisterFlags :: RegisterFlags
defaultRegisterFlags = RegisterFlags {
regPackageDB :: Flag PackageDB
regPackageDB = Flag PackageDB
forall a. Flag a
NoFlag,
regGenScript :: Flag Bool
regGenScript = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
regGenPkgConf :: Flag (Maybe String)
regGenPkgConf = Flag (Maybe String)
forall a. Flag a
NoFlag,
regInPlace :: Flag Bool
regInPlace = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
regDistPref :: Flag String
regDistPref = Flag String
forall a. Flag a
NoFlag,
regPrintId :: Flag Bool
regPrintId = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
regArgs :: [String]
regArgs = [],
regCabalFilePath :: Flag String
regCabalFilePath = Flag String
forall a. Monoid a => a
mempty,
regVerbosity :: Flag Verbosity
regVerbosity = Verbosity -> Flag Verbosity
forall a. a -> Flag a
Flag Verbosity
normal
}
registerCommand :: CommandUI RegisterFlags
registerCommand :: CommandUI RegisterFlags
registerCommand = CommandUI
{ commandName :: String
commandName = String
"register"
, commandSynopsis :: String
commandSynopsis =
String
"Register this package with the compiler."
, commandDescription :: Maybe (String -> String)
commandDescription = Maybe (String -> String)
forall a. Maybe a
Nothing
, commandNotes :: Maybe (String -> String)
commandNotes = Maybe (String -> String)
forall a. Maybe a
Nothing
, commandUsage :: String -> String
commandUsage = \String
pname ->
String
"Usage: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
pname String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" register [FLAGS]\n"
, commandDefaultFlags :: RegisterFlags
commandDefaultFlags = RegisterFlags
defaultRegisterFlags
, commandOptions :: ShowOrParseArgs -> [OptionField RegisterFlags]
commandOptions = \ShowOrParseArgs
showOrParseArgs ->
[(RegisterFlags -> Flag Verbosity)
-> (Flag Verbosity -> RegisterFlags -> RegisterFlags)
-> OptionField RegisterFlags
forall flags.
(flags -> Flag Verbosity)
-> (Flag Verbosity -> flags -> flags) -> OptionField flags
optionVerbosity RegisterFlags -> Flag Verbosity
regVerbosity (\Flag Verbosity
v RegisterFlags
flags -> RegisterFlags
flags { regVerbosity = v })
,(RegisterFlags -> Flag String)
-> (Flag String -> RegisterFlags -> RegisterFlags)
-> ShowOrParseArgs
-> OptionField RegisterFlags
forall flags.
(flags -> Flag String)
-> (Flag String -> flags -> flags)
-> ShowOrParseArgs
-> OptionField flags
optionDistPref
RegisterFlags -> Flag String
regDistPref (\Flag String
d RegisterFlags
flags -> RegisterFlags
flags { regDistPref = d })
ShowOrParseArgs
showOrParseArgs
,String
-> [String]
-> String
-> (RegisterFlags -> Flag PackageDB)
-> (Flag PackageDB -> RegisterFlags -> RegisterFlags)
-> MkOptDescr
(RegisterFlags -> Flag PackageDB)
(Flag PackageDB -> RegisterFlags -> RegisterFlags)
RegisterFlags
-> OptionField RegisterFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"packageDB"] String
""
RegisterFlags -> Flag PackageDB
regPackageDB (\Flag PackageDB
v RegisterFlags
flags -> RegisterFlags
flags { regPackageDB = v })
([(Flag PackageDB, (String, [String]), String)]
-> MkOptDescr
(RegisterFlags -> Flag PackageDB)
(Flag PackageDB -> RegisterFlags -> RegisterFlags)
RegisterFlags
forall b a.
Eq b =>
[(b, (String, [String]), String)]
-> MkOptDescr (a -> b) (b -> a -> a) a
choiceOpt [ (PackageDB -> Flag PackageDB
forall a. a -> Flag a
Flag PackageDB
UserPackageDB, ([],[String
"user"]),
String
"upon registration, register this package in the user's local package database")
, (PackageDB -> Flag PackageDB
forall a. a -> Flag a
Flag PackageDB
GlobalPackageDB, ([],[String
"global"]),
String
"(default)upon registration, register this package in the system-wide package database")])
,String
-> [String]
-> String
-> (RegisterFlags -> Flag Bool)
-> (Flag Bool -> RegisterFlags -> RegisterFlags)
-> MkOptDescr
(RegisterFlags -> Flag Bool)
(Flag Bool -> RegisterFlags -> RegisterFlags)
RegisterFlags
-> OptionField RegisterFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"inplace"]
String
"register the package in the build location, so it can be used without being installed"
RegisterFlags -> Flag Bool
regInPlace (\Flag Bool
v RegisterFlags
flags -> RegisterFlags
flags { regInPlace = v })
MkOptDescr
(RegisterFlags -> Flag Bool)
(Flag Bool -> RegisterFlags -> RegisterFlags)
RegisterFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (RegisterFlags -> Flag Bool)
-> (Flag Bool -> RegisterFlags -> RegisterFlags)
-> MkOptDescr
(RegisterFlags -> Flag Bool)
(Flag Bool -> RegisterFlags -> RegisterFlags)
RegisterFlags
-> OptionField RegisterFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"gen-script"]
String
"instead of registering, generate a script to register later"
RegisterFlags -> Flag Bool
regGenScript (\Flag Bool
v RegisterFlags
flags -> RegisterFlags
flags { regGenScript = v })
MkOptDescr
(RegisterFlags -> Flag Bool)
(Flag Bool -> RegisterFlags -> RegisterFlags)
RegisterFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (RegisterFlags -> Flag (Maybe String))
-> (Flag (Maybe String) -> RegisterFlags -> RegisterFlags)
-> MkOptDescr
(RegisterFlags -> Flag (Maybe String))
(Flag (Maybe String) -> RegisterFlags -> RegisterFlags)
RegisterFlags
-> OptionField RegisterFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"gen-pkg-config"]
String
"instead of registering, generate a package registration file/directory"
RegisterFlags -> Flag (Maybe String)
regGenPkgConf (\Flag (Maybe String)
v RegisterFlags
flags -> RegisterFlags
flags { regGenPkgConf = v })
(String
-> (Maybe String -> Flag (Maybe String))
-> (Flag (Maybe String) -> [Maybe String])
-> MkOptDescr
(RegisterFlags -> Flag (Maybe String))
(Flag (Maybe String) -> RegisterFlags -> RegisterFlags)
RegisterFlags
forall b a.
Monoid b =>
String
-> (Maybe String -> b)
-> (b -> [Maybe String])
-> MkOptDescr (a -> b) (b -> a -> a) a
optArg' String
"PKG" Maybe String -> Flag (Maybe String)
forall a. a -> Flag a
Flag Flag (Maybe String) -> [Maybe String]
forall a. Flag a -> [a]
flagToList)
,String
-> [String]
-> String
-> (RegisterFlags -> Flag Bool)
-> (Flag Bool -> RegisterFlags -> RegisterFlags)
-> MkOptDescr
(RegisterFlags -> Flag Bool)
(Flag Bool -> RegisterFlags -> RegisterFlags)
RegisterFlags
-> OptionField RegisterFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"print-ipid"]
String
"print the installed package ID calculated for this package"
RegisterFlags -> Flag Bool
regPrintId (\Flag Bool
v RegisterFlags
flags -> RegisterFlags
flags { regPrintId = v })
MkOptDescr
(RegisterFlags -> Flag Bool)
(Flag Bool -> RegisterFlags -> RegisterFlags)
RegisterFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
]
}
unregisterCommand :: CommandUI RegisterFlags
unregisterCommand :: CommandUI RegisterFlags
unregisterCommand = CommandUI
{ commandName :: String
commandName = String
"unregister"
, commandSynopsis :: String
commandSynopsis =
String
"Unregister this package with the compiler."
, commandDescription :: Maybe (String -> String)
commandDescription = Maybe (String -> String)
forall a. Maybe a
Nothing
, commandNotes :: Maybe (String -> String)
commandNotes = Maybe (String -> String)
forall a. Maybe a
Nothing
, commandUsage :: String -> String
commandUsage = \String
pname ->
String
"Usage: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
pname String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" unregister [FLAGS]\n"
, commandDefaultFlags :: RegisterFlags
commandDefaultFlags = RegisterFlags
defaultRegisterFlags
, commandOptions :: ShowOrParseArgs -> [OptionField RegisterFlags]
commandOptions = \ShowOrParseArgs
showOrParseArgs ->
[(RegisterFlags -> Flag Verbosity)
-> (Flag Verbosity -> RegisterFlags -> RegisterFlags)
-> OptionField RegisterFlags
forall flags.
(flags -> Flag Verbosity)
-> (Flag Verbosity -> flags -> flags) -> OptionField flags
optionVerbosity RegisterFlags -> Flag Verbosity
regVerbosity (\Flag Verbosity
v RegisterFlags
flags -> RegisterFlags
flags { regVerbosity = v })
,(RegisterFlags -> Flag String)
-> (Flag String -> RegisterFlags -> RegisterFlags)
-> ShowOrParseArgs
-> OptionField RegisterFlags
forall flags.
(flags -> Flag String)
-> (Flag String -> flags -> flags)
-> ShowOrParseArgs
-> OptionField flags
optionDistPref
RegisterFlags -> Flag String
regDistPref (\Flag String
d RegisterFlags
flags -> RegisterFlags
flags { regDistPref = d })
ShowOrParseArgs
showOrParseArgs
,String
-> [String]
-> String
-> (RegisterFlags -> Flag PackageDB)
-> (Flag PackageDB -> RegisterFlags -> RegisterFlags)
-> MkOptDescr
(RegisterFlags -> Flag PackageDB)
(Flag PackageDB -> RegisterFlags -> RegisterFlags)
RegisterFlags
-> OptionField RegisterFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"user"] String
""
RegisterFlags -> Flag PackageDB
regPackageDB (\Flag PackageDB
v RegisterFlags
flags -> RegisterFlags
flags { regPackageDB = v })
([(Flag PackageDB, (String, [String]), String)]
-> MkOptDescr
(RegisterFlags -> Flag PackageDB)
(Flag PackageDB -> RegisterFlags -> RegisterFlags)
RegisterFlags
forall b a.
Eq b =>
[(b, (String, [String]), String)]
-> MkOptDescr (a -> b) (b -> a -> a) a
choiceOpt [ (PackageDB -> Flag PackageDB
forall a. a -> Flag a
Flag PackageDB
UserPackageDB, ([],[String
"user"]),
String
"unregister this package in the user's local package database")
, (PackageDB -> Flag PackageDB
forall a. a -> Flag a
Flag PackageDB
GlobalPackageDB, ([],[String
"global"]),
String
"(default) unregister this package in the system-wide package database")])
,String
-> [String]
-> String
-> (RegisterFlags -> Flag Bool)
-> (Flag Bool -> RegisterFlags -> RegisterFlags)
-> MkOptDescr
(RegisterFlags -> Flag Bool)
(Flag Bool -> RegisterFlags -> RegisterFlags)
RegisterFlags
-> OptionField RegisterFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"gen-script"]
String
"Instead of performing the unregister command, generate a script to unregister later"
RegisterFlags -> Flag Bool
regGenScript (\Flag Bool
v RegisterFlags
flags -> RegisterFlags
flags { regGenScript = v })
MkOptDescr
(RegisterFlags -> Flag Bool)
(Flag Bool -> RegisterFlags -> RegisterFlags)
RegisterFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
]
}
emptyRegisterFlags :: RegisterFlags
emptyRegisterFlags :: RegisterFlags
emptyRegisterFlags = RegisterFlags
forall a. Monoid a => a
mempty
instance Monoid RegisterFlags where
mempty :: RegisterFlags
mempty = RegisterFlags
forall a. (Generic a, GMonoid (Rep a)) => a
gmempty
mappend :: RegisterFlags -> RegisterFlags -> RegisterFlags
mappend = RegisterFlags -> RegisterFlags -> RegisterFlags
forall a. Semigroup a => a -> a -> a
(<>)
instance Semigroup RegisterFlags where
<> :: RegisterFlags -> RegisterFlags -> RegisterFlags
(<>) = RegisterFlags -> RegisterFlags -> RegisterFlags
forall a. (Generic a, GSemigroup (Rep a)) => a -> a -> a
gmappend
data HscolourFlags = HscolourFlags {
HscolourFlags -> Flag String
hscolourCSS :: Flag FilePath,
HscolourFlags -> Flag Bool
hscolourExecutables :: Flag Bool,
HscolourFlags -> Flag Bool
hscolourTestSuites :: Flag Bool,
HscolourFlags -> Flag Bool
hscolourBenchmarks :: Flag Bool,
HscolourFlags -> Flag Bool
hscolourForeignLibs :: Flag Bool,
HscolourFlags -> Flag String
hscolourDistPref :: Flag FilePath,
HscolourFlags -> Flag Verbosity
hscolourVerbosity :: Flag Verbosity,
HscolourFlags -> Flag String
hscolourCabalFilePath :: Flag FilePath
}
deriving (Int -> HscolourFlags -> String -> String
[HscolourFlags] -> String -> String
HscolourFlags -> String
(Int -> HscolourFlags -> String -> String)
-> (HscolourFlags -> String)
-> ([HscolourFlags] -> String -> String)
-> Show HscolourFlags
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> HscolourFlags -> String -> String
showsPrec :: Int -> HscolourFlags -> String -> String
$cshow :: HscolourFlags -> String
show :: HscolourFlags -> String
$cshowList :: [HscolourFlags] -> String -> String
showList :: [HscolourFlags] -> String -> String
Show, (forall x. HscolourFlags -> Rep HscolourFlags x)
-> (forall x. Rep HscolourFlags x -> HscolourFlags)
-> Generic HscolourFlags
forall x. Rep HscolourFlags x -> HscolourFlags
forall x. HscolourFlags -> Rep HscolourFlags x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. HscolourFlags -> Rep HscolourFlags x
from :: forall x. HscolourFlags -> Rep HscolourFlags x
$cto :: forall x. Rep HscolourFlags x -> HscolourFlags
to :: forall x. Rep HscolourFlags x -> HscolourFlags
Generic, Typeable)
emptyHscolourFlags :: HscolourFlags
emptyHscolourFlags :: HscolourFlags
emptyHscolourFlags = HscolourFlags
forall a. Monoid a => a
mempty
defaultHscolourFlags :: HscolourFlags
defaultHscolourFlags :: HscolourFlags
defaultHscolourFlags = HscolourFlags {
hscolourCSS :: Flag String
hscolourCSS = Flag String
forall a. Flag a
NoFlag,
hscolourExecutables :: Flag Bool
hscolourExecutables = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
hscolourTestSuites :: Flag Bool
hscolourTestSuites = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
hscolourBenchmarks :: Flag Bool
hscolourBenchmarks = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
hscolourDistPref :: Flag String
hscolourDistPref = Flag String
forall a. Flag a
NoFlag,
hscolourForeignLibs :: Flag Bool
hscolourForeignLibs = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
hscolourVerbosity :: Flag Verbosity
hscolourVerbosity = Verbosity -> Flag Verbosity
forall a. a -> Flag a
Flag Verbosity
normal,
hscolourCabalFilePath :: Flag String
hscolourCabalFilePath = Flag String
forall a. Monoid a => a
mempty
}
instance Monoid HscolourFlags where
mempty :: HscolourFlags
mempty = HscolourFlags
forall a. (Generic a, GMonoid (Rep a)) => a
gmempty
mappend :: HscolourFlags -> HscolourFlags -> HscolourFlags
mappend = HscolourFlags -> HscolourFlags -> HscolourFlags
forall a. Semigroup a => a -> a -> a
(<>)
instance Semigroup HscolourFlags where
<> :: HscolourFlags -> HscolourFlags -> HscolourFlags
(<>) = HscolourFlags -> HscolourFlags -> HscolourFlags
forall a. (Generic a, GSemigroup (Rep a)) => a -> a -> a
gmappend
hscolourCommand :: CommandUI HscolourFlags
hscolourCommand :: CommandUI HscolourFlags
hscolourCommand = CommandUI
{ commandName :: String
commandName = String
"hscolour"
, commandSynopsis :: String
commandSynopsis =
String
"Generate HsColour colourised code, in HTML format."
, commandDescription :: Maybe (String -> String)
commandDescription = (String -> String) -> Maybe (String -> String)
forall a. a -> Maybe a
Just (\String
_ -> String
"Requires the hscolour program.\n")
, commandNotes :: Maybe (String -> String)
commandNotes = (String -> String) -> Maybe (String -> String)
forall a. a -> Maybe a
Just ((String -> String) -> Maybe (String -> String))
-> (String -> String) -> Maybe (String -> String)
forall a b. (a -> b) -> a -> b
$ \String
_ ->
String
"Deprecated in favour of 'cabal haddock --hyperlink-source'."
, commandUsage :: String -> String
commandUsage = \String
pname ->
String
"Usage: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
pname String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" hscolour [FLAGS]\n"
, commandDefaultFlags :: HscolourFlags
commandDefaultFlags = HscolourFlags
defaultHscolourFlags
, commandOptions :: ShowOrParseArgs -> [OptionField HscolourFlags]
commandOptions = \ShowOrParseArgs
showOrParseArgs ->
[(HscolourFlags -> Flag Verbosity)
-> (Flag Verbosity -> HscolourFlags -> HscolourFlags)
-> OptionField HscolourFlags
forall flags.
(flags -> Flag Verbosity)
-> (Flag Verbosity -> flags -> flags) -> OptionField flags
optionVerbosity HscolourFlags -> Flag Verbosity
hscolourVerbosity
(\Flag Verbosity
v HscolourFlags
flags -> HscolourFlags
flags { hscolourVerbosity = v })
,(HscolourFlags -> Flag String)
-> (Flag String -> HscolourFlags -> HscolourFlags)
-> ShowOrParseArgs
-> OptionField HscolourFlags
forall flags.
(flags -> Flag String)
-> (Flag String -> flags -> flags)
-> ShowOrParseArgs
-> OptionField flags
optionDistPref
HscolourFlags -> Flag String
hscolourDistPref (\Flag String
d HscolourFlags
flags -> HscolourFlags
flags { hscolourDistPref = d })
ShowOrParseArgs
showOrParseArgs
,String
-> [String]
-> String
-> (HscolourFlags -> Flag Bool)
-> (Flag Bool -> HscolourFlags -> HscolourFlags)
-> MkOptDescr
(HscolourFlags -> Flag Bool)
(Flag Bool -> HscolourFlags -> HscolourFlags)
HscolourFlags
-> OptionField HscolourFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"executables"]
String
"Run hscolour for Executables targets"
HscolourFlags -> Flag Bool
hscolourExecutables (\Flag Bool
v HscolourFlags
flags -> HscolourFlags
flags { hscolourExecutables = v })
MkOptDescr
(HscolourFlags -> Flag Bool)
(Flag Bool -> HscolourFlags -> HscolourFlags)
HscolourFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (HscolourFlags -> Flag Bool)
-> (Flag Bool -> HscolourFlags -> HscolourFlags)
-> MkOptDescr
(HscolourFlags -> Flag Bool)
(Flag Bool -> HscolourFlags -> HscolourFlags)
HscolourFlags
-> OptionField HscolourFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"tests"]
String
"Run hscolour for Test Suite targets"
HscolourFlags -> Flag Bool
hscolourTestSuites (\Flag Bool
v HscolourFlags
flags -> HscolourFlags
flags { hscolourTestSuites = v })
MkOptDescr
(HscolourFlags -> Flag Bool)
(Flag Bool -> HscolourFlags -> HscolourFlags)
HscolourFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (HscolourFlags -> Flag Bool)
-> (Flag Bool -> HscolourFlags -> HscolourFlags)
-> MkOptDescr
(HscolourFlags -> Flag Bool)
(Flag Bool -> HscolourFlags -> HscolourFlags)
HscolourFlags
-> OptionField HscolourFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"benchmarks"]
String
"Run hscolour for Benchmark targets"
HscolourFlags -> Flag Bool
hscolourBenchmarks (\Flag Bool
v HscolourFlags
flags -> HscolourFlags
flags { hscolourBenchmarks = v })
MkOptDescr
(HscolourFlags -> Flag Bool)
(Flag Bool -> HscolourFlags -> HscolourFlags)
HscolourFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (HscolourFlags -> Flag Bool)
-> (Flag Bool -> HscolourFlags -> HscolourFlags)
-> MkOptDescr
(HscolourFlags -> Flag Bool)
(Flag Bool -> HscolourFlags -> HscolourFlags)
HscolourFlags
-> OptionField HscolourFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"foreign-libraries"]
String
"Run hscolour for Foreign Library targets"
HscolourFlags -> Flag Bool
hscolourForeignLibs (\Flag Bool
v HscolourFlags
flags -> HscolourFlags
flags { hscolourForeignLibs = v })
MkOptDescr
(HscolourFlags -> Flag Bool)
(Flag Bool -> HscolourFlags -> HscolourFlags)
HscolourFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (HscolourFlags -> Flag Bool)
-> (Flag Bool -> HscolourFlags -> HscolourFlags)
-> MkOptDescr
(HscolourFlags -> Flag Bool)
(Flag Bool -> HscolourFlags -> HscolourFlags)
HscolourFlags
-> OptionField HscolourFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"all"]
String
"Run hscolour for all targets"
(\HscolourFlags
f -> [Flag Bool] -> Flag Bool
allFlags [ HscolourFlags -> Flag Bool
hscolourExecutables HscolourFlags
f
, HscolourFlags -> Flag Bool
hscolourTestSuites HscolourFlags
f
, HscolourFlags -> Flag Bool
hscolourBenchmarks HscolourFlags
f
, HscolourFlags -> Flag Bool
hscolourForeignLibs HscolourFlags
f
])
(\Flag Bool
v HscolourFlags
flags -> HscolourFlags
flags { hscolourExecutables = v
, hscolourTestSuites = v
, hscolourBenchmarks = v
, hscolourForeignLibs = v
})
MkOptDescr
(HscolourFlags -> Flag Bool)
(Flag Bool -> HscolourFlags -> HscolourFlags)
HscolourFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (HscolourFlags -> Flag String)
-> (Flag String -> HscolourFlags -> HscolourFlags)
-> MkOptDescr
(HscolourFlags -> Flag String)
(Flag String -> HscolourFlags -> HscolourFlags)
HscolourFlags
-> OptionField HscolourFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"css"]
String
"Use a cascading style sheet"
HscolourFlags -> Flag String
hscolourCSS (\Flag String
v HscolourFlags
flags -> HscolourFlags
flags { hscolourCSS = v })
(String
-> MkOptDescr
(HscolourFlags -> Flag String)
(Flag String -> HscolourFlags -> HscolourFlags)
HscolourFlags
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
"PATH")
]
}
data HaddockTarget = ForHackage | ForDevelopment deriving (HaddockTarget -> HaddockTarget -> Bool
(HaddockTarget -> HaddockTarget -> Bool)
-> (HaddockTarget -> HaddockTarget -> Bool) -> Eq HaddockTarget
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: HaddockTarget -> HaddockTarget -> Bool
== :: HaddockTarget -> HaddockTarget -> Bool
$c/= :: HaddockTarget -> HaddockTarget -> Bool
/= :: HaddockTarget -> HaddockTarget -> Bool
Eq, Int -> HaddockTarget -> String -> String
[HaddockTarget] -> String -> String
HaddockTarget -> String
(Int -> HaddockTarget -> String -> String)
-> (HaddockTarget -> String)
-> ([HaddockTarget] -> String -> String)
-> Show HaddockTarget
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> HaddockTarget -> String -> String
showsPrec :: Int -> HaddockTarget -> String -> String
$cshow :: HaddockTarget -> String
show :: HaddockTarget -> String
$cshowList :: [HaddockTarget] -> String -> String
showList :: [HaddockTarget] -> String -> String
Show, (forall x. HaddockTarget -> Rep HaddockTarget x)
-> (forall x. Rep HaddockTarget x -> HaddockTarget)
-> Generic HaddockTarget
forall x. Rep HaddockTarget x -> HaddockTarget
forall x. HaddockTarget -> Rep HaddockTarget x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. HaddockTarget -> Rep HaddockTarget x
from :: forall x. HaddockTarget -> Rep HaddockTarget x
$cto :: forall x. Rep HaddockTarget x -> HaddockTarget
to :: forall x. Rep HaddockTarget x -> HaddockTarget
Generic, Typeable)
instance Binary HaddockTarget
instance Structured HaddockTarget
instance Pretty HaddockTarget where
pretty :: HaddockTarget -> Doc
pretty HaddockTarget
ForHackage = String -> Doc
Disp.text String
"for-hackage"
pretty HaddockTarget
ForDevelopment = String -> Doc
Disp.text String
"for-development"
instance Parsec HaddockTarget where
parsec :: forall (m :: * -> *). CabalParsing m => m HaddockTarget
parsec = [m HaddockTarget] -> m HaddockTarget
forall (m :: * -> *) a. Alternative m => [m a] -> m a
P.choice [ m HaddockTarget -> m HaddockTarget
forall a. m a -> m a
forall (m :: * -> *) a. Parsing m => m a -> m a
P.try (m HaddockTarget -> m HaddockTarget)
-> m HaddockTarget -> m HaddockTarget
forall a b. (a -> b) -> a -> b
$ String -> m String
forall (m :: * -> *). CharParsing m => String -> m String
P.string String
"for-hackage" m String -> m HaddockTarget -> m HaddockTarget
forall a b. m a -> m b -> m b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> HaddockTarget -> m HaddockTarget
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return HaddockTarget
ForHackage
, String -> m String
forall (m :: * -> *). CharParsing m => String -> m String
P.string String
"for-development" m String -> m HaddockTarget -> m HaddockTarget
forall a b. m a -> m b -> m b
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> HaddockTarget -> m HaddockTarget
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return HaddockTarget
ForDevelopment]
data HaddockFlags = HaddockFlags {
HaddockFlags -> [(String, String)]
haddockProgramPaths :: [(String, FilePath)],
HaddockFlags -> [(String, [String])]
haddockProgramArgs :: [(String, [String])],
HaddockFlags -> Flag Bool
haddockHoogle :: Flag Bool,
HaddockFlags -> Flag Bool
haddockHtml :: Flag Bool,
HaddockFlags -> Flag String
haddockHtmlLocation :: Flag String,
HaddockFlags -> Flag HaddockTarget
haddockForHackage :: Flag HaddockTarget,
HaddockFlags -> Flag Bool
haddockExecutables :: Flag Bool,
HaddockFlags -> Flag Bool
haddockTestSuites :: Flag Bool,
HaddockFlags -> Flag Bool
haddockBenchmarks :: Flag Bool,
HaddockFlags -> Flag Bool
haddockForeignLibs :: Flag Bool,
HaddockFlags -> Flag Bool
haddockInternal :: Flag Bool,
HaddockFlags -> Flag String
haddockCss :: Flag FilePath,
HaddockFlags -> Flag Bool
haddockLinkedSource :: Flag Bool,
HaddockFlags -> Flag Bool
haddockQuickJump :: Flag Bool,
HaddockFlags -> Flag String
haddockHscolourCss :: Flag FilePath,
HaddockFlags -> Flag PathTemplate
haddockContents :: Flag PathTemplate,
HaddockFlags -> Flag PathTemplate
haddockIndex :: Flag PathTemplate,
HaddockFlags -> Flag String
haddockDistPref :: Flag FilePath,
HaddockFlags -> Flag Bool
haddockKeepTempFiles:: Flag Bool,
HaddockFlags -> Flag Verbosity
haddockVerbosity :: Flag Verbosity,
HaddockFlags -> Flag String
haddockCabalFilePath :: Flag FilePath,
HaddockFlags -> Flag String
haddockBaseUrl :: Flag String,
HaddockFlags -> Flag String
haddockLib :: Flag String,
HaddockFlags -> [String]
haddockArgs :: [String]
}
deriving (Int -> HaddockFlags -> String -> String
[HaddockFlags] -> String -> String
HaddockFlags -> String
(Int -> HaddockFlags -> String -> String)
-> (HaddockFlags -> String)
-> ([HaddockFlags] -> String -> String)
-> Show HaddockFlags
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> HaddockFlags -> String -> String
showsPrec :: Int -> HaddockFlags -> String -> String
$cshow :: HaddockFlags -> String
show :: HaddockFlags -> String
$cshowList :: [HaddockFlags] -> String -> String
showList :: [HaddockFlags] -> String -> String
Show, (forall x. HaddockFlags -> Rep HaddockFlags x)
-> (forall x. Rep HaddockFlags x -> HaddockFlags)
-> Generic HaddockFlags
forall x. Rep HaddockFlags x -> HaddockFlags
forall x. HaddockFlags -> Rep HaddockFlags x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. HaddockFlags -> Rep HaddockFlags x
from :: forall x. HaddockFlags -> Rep HaddockFlags x
$cto :: forall x. Rep HaddockFlags x -> HaddockFlags
to :: forall x. Rep HaddockFlags x -> HaddockFlags
Generic, Typeable)
defaultHaddockFlags :: HaddockFlags
defaultHaddockFlags :: HaddockFlags
defaultHaddockFlags = HaddockFlags {
haddockProgramPaths :: [(String, String)]
haddockProgramPaths = [(String, String)]
forall a. Monoid a => a
mempty,
haddockProgramArgs :: [(String, [String])]
haddockProgramArgs = [],
haddockHoogle :: Flag Bool
haddockHoogle = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
haddockHtml :: Flag Bool
haddockHtml = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
haddockHtmlLocation :: Flag String
haddockHtmlLocation = Flag String
forall a. Flag a
NoFlag,
haddockForHackage :: Flag HaddockTarget
haddockForHackage = Flag HaddockTarget
forall a. Flag a
NoFlag,
haddockExecutables :: Flag Bool
haddockExecutables = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
haddockTestSuites :: Flag Bool
haddockTestSuites = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
haddockBenchmarks :: Flag Bool
haddockBenchmarks = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
haddockForeignLibs :: Flag Bool
haddockForeignLibs = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
haddockInternal :: Flag Bool
haddockInternal = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
haddockCss :: Flag String
haddockCss = Flag String
forall a. Flag a
NoFlag,
haddockLinkedSource :: Flag Bool
haddockLinkedSource = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
haddockQuickJump :: Flag Bool
haddockQuickJump = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
haddockHscolourCss :: Flag String
haddockHscolourCss = Flag String
forall a. Flag a
NoFlag,
haddockContents :: Flag PathTemplate
haddockContents = Flag PathTemplate
forall a. Flag a
NoFlag,
haddockDistPref :: Flag String
haddockDistPref = Flag String
forall a. Flag a
NoFlag,
haddockKeepTempFiles :: Flag Bool
haddockKeepTempFiles= Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
haddockVerbosity :: Flag Verbosity
haddockVerbosity = Verbosity -> Flag Verbosity
forall a. a -> Flag a
Flag Verbosity
normal,
haddockCabalFilePath :: Flag String
haddockCabalFilePath = Flag String
forall a. Monoid a => a
mempty,
haddockIndex :: Flag PathTemplate
haddockIndex = Flag PathTemplate
forall a. Flag a
NoFlag,
haddockBaseUrl :: Flag String
haddockBaseUrl = Flag String
forall a. Flag a
NoFlag,
haddockLib :: Flag String
haddockLib = Flag String
forall a. Flag a
NoFlag,
haddockArgs :: [String]
haddockArgs = [String]
forall a. Monoid a => a
mempty
}
haddockCommand :: CommandUI HaddockFlags
haddockCommand :: CommandUI HaddockFlags
haddockCommand = CommandUI
{ commandName :: String
commandName = String
"haddock"
, commandSynopsis :: String
commandSynopsis = String
"Generate Haddock HTML documentation."
, commandDescription :: Maybe (String -> String)
commandDescription = (String -> String) -> Maybe (String -> String)
forall a. a -> Maybe a
Just ((String -> String) -> Maybe (String -> String))
-> (String -> String) -> Maybe (String -> String)
forall a b. (a -> b) -> a -> b
$ \String
_ ->
String
"Requires the program haddock, version 2.x.\n"
, commandNotes :: Maybe (String -> String)
commandNotes = Maybe (String -> String)
forall a. Maybe a
Nothing
, commandUsage :: String -> String
commandUsage = String -> [String] -> String -> String
usageAlternatives String
"haddock" ([String] -> String -> String) -> [String] -> String -> String
forall a b. (a -> b) -> a -> b
$
[ String
"[FLAGS]"
, String
"COMPONENTS [FLAGS]"
]
, commandDefaultFlags :: HaddockFlags
commandDefaultFlags = HaddockFlags
defaultHaddockFlags
, commandOptions :: ShowOrParseArgs -> [OptionField HaddockFlags]
commandOptions = \ShowOrParseArgs
showOrParseArgs ->
ShowOrParseArgs -> [OptionField HaddockFlags]
haddockOptions ShowOrParseArgs
showOrParseArgs
[OptionField HaddockFlags]
-> [OptionField HaddockFlags] -> [OptionField HaddockFlags]
forall a. [a] -> [a] -> [a]
++ ProgramDb
-> ShowOrParseArgs
-> (HaddockFlags -> [(String, String)])
-> ([(String, String)] -> HaddockFlags -> HaddockFlags)
-> [OptionField HaddockFlags]
forall flags.
ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, String)])
-> ([(String, String)] -> flags -> flags)
-> [OptionField flags]
programDbPaths ProgramDb
progDb ShowOrParseArgs
ParseArgs
HaddockFlags -> [(String, String)]
haddockProgramPaths (\[(String, String)]
v HaddockFlags
flags -> HaddockFlags
flags { haddockProgramPaths = v})
[OptionField HaddockFlags]
-> [OptionField HaddockFlags] -> [OptionField HaddockFlags]
forall a. [a] -> [a] -> [a]
++ ProgramDb
-> ShowOrParseArgs
-> (HaddockFlags -> [(String, [String])])
-> ([(String, [String])] -> HaddockFlags -> HaddockFlags)
-> [OptionField HaddockFlags]
forall flags.
ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, [String])])
-> ([(String, [String])] -> flags -> flags)
-> [OptionField flags]
programDbOption ProgramDb
progDb ShowOrParseArgs
showOrParseArgs
HaddockFlags -> [(String, [String])]
haddockProgramArgs (\[(String, [String])]
v HaddockFlags
fs -> HaddockFlags
fs { haddockProgramArgs = v })
[OptionField HaddockFlags]
-> [OptionField HaddockFlags] -> [OptionField HaddockFlags]
forall a. [a] -> [a] -> [a]
++ ProgramDb
-> ShowOrParseArgs
-> (HaddockFlags -> [(String, [String])])
-> ([(String, [String])] -> HaddockFlags -> HaddockFlags)
-> [OptionField HaddockFlags]
forall flags.
ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, [String])])
-> ([(String, [String])] -> flags -> flags)
-> [OptionField flags]
programDbOptions ProgramDb
progDb ShowOrParseArgs
ParseArgs
HaddockFlags -> [(String, [String])]
haddockProgramArgs (\[(String, [String])]
v HaddockFlags
flags -> HaddockFlags
flags { haddockProgramArgs = v})
}
where
progDb :: ProgramDb
progDb = Program -> ProgramDb -> ProgramDb
addKnownProgram Program
haddockProgram
(ProgramDb -> ProgramDb) -> ProgramDb -> ProgramDb
forall a b. (a -> b) -> a -> b
$ Program -> ProgramDb -> ProgramDb
addKnownProgram Program
ghcProgram
(ProgramDb -> ProgramDb) -> ProgramDb -> ProgramDb
forall a b. (a -> b) -> a -> b
$ ProgramDb
emptyProgramDb
haddockOptions :: ShowOrParseArgs -> [OptionField HaddockFlags]
haddockOptions :: ShowOrParseArgs -> [OptionField HaddockFlags]
haddockOptions ShowOrParseArgs
showOrParseArgs =
[(HaddockFlags -> Flag Verbosity)
-> (Flag Verbosity -> HaddockFlags -> HaddockFlags)
-> OptionField HaddockFlags
forall flags.
(flags -> Flag Verbosity)
-> (Flag Verbosity -> flags -> flags) -> OptionField flags
optionVerbosity HaddockFlags -> Flag Verbosity
haddockVerbosity
(\Flag Verbosity
v HaddockFlags
flags -> HaddockFlags
flags { haddockVerbosity = v })
,(HaddockFlags -> Flag String)
-> (Flag String -> HaddockFlags -> HaddockFlags)
-> ShowOrParseArgs
-> OptionField HaddockFlags
forall flags.
(flags -> Flag String)
-> (Flag String -> flags -> flags)
-> ShowOrParseArgs
-> OptionField flags
optionDistPref
HaddockFlags -> Flag String
haddockDistPref (\Flag String
d HaddockFlags
flags -> HaddockFlags
flags { haddockDistPref = d })
ShowOrParseArgs
showOrParseArgs
,String
-> [String]
-> String
-> (HaddockFlags -> Flag Bool)
-> (Flag Bool -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
(HaddockFlags -> Flag Bool)
(Flag Bool -> HaddockFlags -> HaddockFlags)
HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"keep-temp-files"]
String
"Keep temporary files"
HaddockFlags -> Flag Bool
haddockKeepTempFiles (\Flag Bool
b HaddockFlags
flags -> HaddockFlags
flags { haddockKeepTempFiles = b })
MkOptDescr
(HaddockFlags -> Flag Bool)
(Flag Bool -> HaddockFlags -> HaddockFlags)
HaddockFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (HaddockFlags -> Flag Bool)
-> (Flag Bool -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
(HaddockFlags -> Flag Bool)
(Flag Bool -> HaddockFlags -> HaddockFlags)
HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"hoogle"]
String
"Generate a hoogle database"
HaddockFlags -> Flag Bool
haddockHoogle (\Flag Bool
v HaddockFlags
flags -> HaddockFlags
flags { haddockHoogle = v })
MkOptDescr
(HaddockFlags -> Flag Bool)
(Flag Bool -> HaddockFlags -> HaddockFlags)
HaddockFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (HaddockFlags -> Flag Bool)
-> (Flag Bool -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
(HaddockFlags -> Flag Bool)
(Flag Bool -> HaddockFlags -> HaddockFlags)
HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"html"]
String
"Generate HTML documentation (the default)"
HaddockFlags -> Flag Bool
haddockHtml (\Flag Bool
v HaddockFlags
flags -> HaddockFlags
flags { haddockHtml = v })
MkOptDescr
(HaddockFlags -> Flag Bool)
(Flag Bool -> HaddockFlags -> HaddockFlags)
HaddockFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (HaddockFlags -> Flag String)
-> (Flag String -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
(HaddockFlags -> Flag String)
(Flag String -> HaddockFlags -> HaddockFlags)
HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"html-location"]
String
"Location of HTML documentation for pre-requisite packages"
HaddockFlags -> Flag String
haddockHtmlLocation (\Flag String
v HaddockFlags
flags -> HaddockFlags
flags { haddockHtmlLocation = v })
(String
-> MkOptDescr
(HaddockFlags -> Flag String)
(Flag String -> HaddockFlags -> HaddockFlags)
HaddockFlags
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
"URL")
,String
-> [String]
-> String
-> (HaddockFlags -> Flag HaddockTarget)
-> (Flag HaddockTarget -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
(HaddockFlags -> Flag HaddockTarget)
(Flag HaddockTarget -> HaddockFlags -> HaddockFlags)
HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"for-hackage"]
String
"Collection of flags to generate documentation suitable for upload to hackage"
HaddockFlags -> Flag HaddockTarget
haddockForHackage (\Flag HaddockTarget
v HaddockFlags
flags -> HaddockFlags
flags { haddockForHackage = v })
(Flag HaddockTarget
-> MkOptDescr
(HaddockFlags -> Flag HaddockTarget)
(Flag HaddockTarget -> HaddockFlags -> HaddockFlags)
HaddockFlags
forall b a. Eq b => b -> MkOptDescr (a -> b) (b -> a -> a) a
noArg (HaddockTarget -> Flag HaddockTarget
forall a. a -> Flag a
Flag HaddockTarget
ForHackage))
,String
-> [String]
-> String
-> (HaddockFlags -> Flag Bool)
-> (Flag Bool -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
(HaddockFlags -> Flag Bool)
(Flag Bool -> HaddockFlags -> HaddockFlags)
HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"executables"]
String
"Run haddock for Executables targets"
HaddockFlags -> Flag Bool
haddockExecutables (\Flag Bool
v HaddockFlags
flags -> HaddockFlags
flags { haddockExecutables = v })
MkOptDescr
(HaddockFlags -> Flag Bool)
(Flag Bool -> HaddockFlags -> HaddockFlags)
HaddockFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (HaddockFlags -> Flag Bool)
-> (Flag Bool -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
(HaddockFlags -> Flag Bool)
(Flag Bool -> HaddockFlags -> HaddockFlags)
HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"tests"]
String
"Run haddock for Test Suite targets"
HaddockFlags -> Flag Bool
haddockTestSuites (\Flag Bool
v HaddockFlags
flags -> HaddockFlags
flags { haddockTestSuites = v })
MkOptDescr
(HaddockFlags -> Flag Bool)
(Flag Bool -> HaddockFlags -> HaddockFlags)
HaddockFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (HaddockFlags -> Flag Bool)
-> (Flag Bool -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
(HaddockFlags -> Flag Bool)
(Flag Bool -> HaddockFlags -> HaddockFlags)
HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"benchmarks"]
String
"Run haddock for Benchmark targets"
HaddockFlags -> Flag Bool
haddockBenchmarks (\Flag Bool
v HaddockFlags
flags -> HaddockFlags
flags { haddockBenchmarks = v })
MkOptDescr
(HaddockFlags -> Flag Bool)
(Flag Bool -> HaddockFlags -> HaddockFlags)
HaddockFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (HaddockFlags -> Flag Bool)
-> (Flag Bool -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
(HaddockFlags -> Flag Bool)
(Flag Bool -> HaddockFlags -> HaddockFlags)
HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"foreign-libraries"]
String
"Run haddock for Foreign Library targets"
HaddockFlags -> Flag Bool
haddockForeignLibs (\Flag Bool
v HaddockFlags
flags -> HaddockFlags
flags { haddockForeignLibs = v })
MkOptDescr
(HaddockFlags -> Flag Bool)
(Flag Bool -> HaddockFlags -> HaddockFlags)
HaddockFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (HaddockFlags -> Flag Bool)
-> (Flag Bool -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
(HaddockFlags -> Flag Bool)
(Flag Bool -> HaddockFlags -> HaddockFlags)
HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"all"]
String
"Run haddock for all targets"
(\HaddockFlags
f -> [Flag Bool] -> Flag Bool
allFlags [ HaddockFlags -> Flag Bool
haddockExecutables HaddockFlags
f
, HaddockFlags -> Flag Bool
haddockTestSuites HaddockFlags
f
, HaddockFlags -> Flag Bool
haddockBenchmarks HaddockFlags
f
, HaddockFlags -> Flag Bool
haddockForeignLibs HaddockFlags
f
])
(\Flag Bool
v HaddockFlags
flags -> HaddockFlags
flags { haddockExecutables = v
, haddockTestSuites = v
, haddockBenchmarks = v
, haddockForeignLibs = v
})
MkOptDescr
(HaddockFlags -> Flag Bool)
(Flag Bool -> HaddockFlags -> HaddockFlags)
HaddockFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (HaddockFlags -> Flag Bool)
-> (Flag Bool -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
(HaddockFlags -> Flag Bool)
(Flag Bool -> HaddockFlags -> HaddockFlags)
HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"internal"]
String
"Run haddock for internal modules and include all symbols"
HaddockFlags -> Flag Bool
haddockInternal (\Flag Bool
v HaddockFlags
flags -> HaddockFlags
flags { haddockInternal = v })
MkOptDescr
(HaddockFlags -> Flag Bool)
(Flag Bool -> HaddockFlags -> HaddockFlags)
HaddockFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (HaddockFlags -> Flag String)
-> (Flag String -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
(HaddockFlags -> Flag String)
(Flag String -> HaddockFlags -> HaddockFlags)
HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"css"]
String
"Use PATH as the haddock stylesheet"
HaddockFlags -> Flag String
haddockCss (\Flag String
v HaddockFlags
flags -> HaddockFlags
flags { haddockCss = v })
(String
-> MkOptDescr
(HaddockFlags -> Flag String)
(Flag String -> HaddockFlags -> HaddockFlags)
HaddockFlags
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
"PATH")
,String
-> [String]
-> String
-> (HaddockFlags -> Flag Bool)
-> (Flag Bool -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
(HaddockFlags -> Flag Bool)
(Flag Bool -> HaddockFlags -> HaddockFlags)
HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"hyperlink-source",String
"hyperlink-sources",String
"hyperlinked-source"]
String
"Hyperlink the documentation to the source code"
HaddockFlags -> Flag Bool
haddockLinkedSource (\Flag Bool
v HaddockFlags
flags -> HaddockFlags
flags { haddockLinkedSource = v })
MkOptDescr
(HaddockFlags -> Flag Bool)
(Flag Bool -> HaddockFlags -> HaddockFlags)
HaddockFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (HaddockFlags -> Flag Bool)
-> (Flag Bool -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
(HaddockFlags -> Flag Bool)
(Flag Bool -> HaddockFlags -> HaddockFlags)
HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"quickjump"]
String
"Generate an index for interactive documentation navigation"
HaddockFlags -> Flag Bool
haddockQuickJump (\Flag Bool
v HaddockFlags
flags -> HaddockFlags
flags { haddockQuickJump = v })
MkOptDescr
(HaddockFlags -> Flag Bool)
(Flag Bool -> HaddockFlags -> HaddockFlags)
HaddockFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (HaddockFlags -> Flag String)
-> (Flag String -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
(HaddockFlags -> Flag String)
(Flag String -> HaddockFlags -> HaddockFlags)
HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"hscolour-css"]
String
"Use PATH as the HsColour stylesheet"
HaddockFlags -> Flag String
haddockHscolourCss (\Flag String
v HaddockFlags
flags -> HaddockFlags
flags { haddockHscolourCss = v })
(String
-> MkOptDescr
(HaddockFlags -> Flag String)
(Flag String -> HaddockFlags -> HaddockFlags)
HaddockFlags
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
"PATH")
,String
-> [String]
-> String
-> (HaddockFlags -> Flag PathTemplate)
-> (Flag PathTemplate -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
(HaddockFlags -> Flag PathTemplate)
(Flag PathTemplate -> HaddockFlags -> HaddockFlags)
HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"contents-location"]
String
"Bake URL in as the location for the contents page"
HaddockFlags -> Flag PathTemplate
haddockContents (\Flag PathTemplate
v HaddockFlags
flags -> HaddockFlags
flags { haddockContents = v })
(String
-> (String -> Flag PathTemplate)
-> (Flag PathTemplate -> [String])
-> MkOptDescr
(HaddockFlags -> Flag PathTemplate)
(Flag PathTemplate -> HaddockFlags -> HaddockFlags)
HaddockFlags
forall b a.
Monoid b =>
String
-> (String -> b)
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg' String
"URL"
(PathTemplate -> Flag PathTemplate
forall a. a -> Flag a
toFlag (PathTemplate -> Flag PathTemplate)
-> (String -> PathTemplate) -> String -> Flag PathTemplate
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> PathTemplate
toPathTemplate)
(Flag String -> [String]
forall a. Flag a -> [a]
flagToList (Flag String -> [String])
-> (Flag PathTemplate -> Flag String)
-> Flag PathTemplate
-> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (PathTemplate -> String) -> Flag PathTemplate -> Flag String
forall a b. (a -> b) -> Flag a -> Flag b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap PathTemplate -> String
fromPathTemplate))
,String
-> [String]
-> String
-> (HaddockFlags -> Flag PathTemplate)
-> (Flag PathTemplate -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
(HaddockFlags -> Flag PathTemplate)
(Flag PathTemplate -> HaddockFlags -> HaddockFlags)
HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"index-location"]
String
"Use a separately-generated HTML index"
HaddockFlags -> Flag PathTemplate
haddockIndex (\Flag PathTemplate
v HaddockFlags
flags -> HaddockFlags
flags { haddockIndex = v})
(String
-> (String -> Flag PathTemplate)
-> (Flag PathTemplate -> [String])
-> MkOptDescr
(HaddockFlags -> Flag PathTemplate)
(Flag PathTemplate -> HaddockFlags -> HaddockFlags)
HaddockFlags
forall b a.
Monoid b =>
String
-> (String -> b)
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg' String
"URL"
(PathTemplate -> Flag PathTemplate
forall a. a -> Flag a
toFlag (PathTemplate -> Flag PathTemplate)
-> (String -> PathTemplate) -> String -> Flag PathTemplate
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> PathTemplate
toPathTemplate)
(Flag String -> [String]
forall a. Flag a -> [a]
flagToList (Flag String -> [String])
-> (Flag PathTemplate -> Flag String)
-> Flag PathTemplate
-> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (PathTemplate -> String) -> Flag PathTemplate -> Flag String
forall a b. (a -> b) -> Flag a -> Flag b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap PathTemplate -> String
fromPathTemplate))
,String
-> [String]
-> String
-> (HaddockFlags -> Flag String)
-> (Flag String -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
(HaddockFlags -> Flag String)
(Flag String -> HaddockFlags -> HaddockFlags)
HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"base-url"]
String
"Base URL for static files."
HaddockFlags -> Flag String
haddockBaseUrl (\Flag String
v HaddockFlags
flags -> HaddockFlags
flags { haddockBaseUrl = v})
(String
-> MkOptDescr
(HaddockFlags -> Flag String)
(Flag String -> HaddockFlags -> HaddockFlags)
HaddockFlags
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
"URL")
,String
-> [String]
-> String
-> (HaddockFlags -> Flag String)
-> (Flag String -> HaddockFlags -> HaddockFlags)
-> MkOptDescr
(HaddockFlags -> Flag String)
(Flag String -> HaddockFlags -> HaddockFlags)
HaddockFlags
-> OptionField HaddockFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"lib"]
String
"location of Haddocks static / auxiliary files"
HaddockFlags -> Flag String
haddockLib (\Flag String
v HaddockFlags
flags -> HaddockFlags
flags { haddockLib = v})
(String
-> MkOptDescr
(HaddockFlags -> Flag String)
(Flag String -> HaddockFlags -> HaddockFlags)
HaddockFlags
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
"DIR")
]
emptyHaddockFlags :: HaddockFlags
emptyHaddockFlags :: HaddockFlags
emptyHaddockFlags = HaddockFlags
forall a. Monoid a => a
mempty
instance Monoid HaddockFlags where
mempty :: HaddockFlags
mempty = HaddockFlags
forall a. (Generic a, GMonoid (Rep a)) => a
gmempty
mappend :: HaddockFlags -> HaddockFlags -> HaddockFlags
mappend = HaddockFlags -> HaddockFlags -> HaddockFlags
forall a. Semigroup a => a -> a -> a
(<>)
instance Semigroup HaddockFlags where
<> :: HaddockFlags -> HaddockFlags -> HaddockFlags
(<>) = HaddockFlags -> HaddockFlags -> HaddockFlags
forall a. (Generic a, GSemigroup (Rep a)) => a -> a -> a
gmappend
data Visibility = Visible | Hidden
deriving (Visibility -> Visibility -> Bool
(Visibility -> Visibility -> Bool)
-> (Visibility -> Visibility -> Bool) -> Eq Visibility
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Visibility -> Visibility -> Bool
== :: Visibility -> Visibility -> Bool
$c/= :: Visibility -> Visibility -> Bool
/= :: Visibility -> Visibility -> Bool
Eq, Int -> Visibility -> String -> String
[Visibility] -> String -> String
Visibility -> String
(Int -> Visibility -> String -> String)
-> (Visibility -> String)
-> ([Visibility] -> String -> String)
-> Show Visibility
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> Visibility -> String -> String
showsPrec :: Int -> Visibility -> String -> String
$cshow :: Visibility -> String
show :: Visibility -> String
$cshowList :: [Visibility] -> String -> String
showList :: [Visibility] -> String -> String
Show)
data HaddockProjectFlags = HaddockProjectFlags {
HaddockProjectFlags -> Flag Bool
haddockProjectHackage :: Flag Bool,
HaddockProjectFlags -> Flag Bool
haddockProjectLocal :: Flag Bool,
HaddockProjectFlags -> Flag String
haddockProjectDir :: Flag String,
HaddockProjectFlags -> Flag String
haddockProjectPrologue :: Flag String,
HaddockProjectFlags -> Flag Bool
haddockProjectGenIndex :: Flag Bool,
HaddockProjectFlags -> Flag Bool
haddockProjectGenContents :: Flag Bool,
HaddockProjectFlags
-> Flag [(String, Maybe String, Maybe String, Visibility)]
haddockProjectInterfaces :: Flag [(FilePath, Maybe FilePath, Maybe FilePath, Visibility)],
HaddockProjectFlags -> [(String, String)]
haddockProjectProgramPaths :: [(String, FilePath)],
HaddockProjectFlags -> [(String, [String])]
haddockProjectProgramArgs :: [(String, [String])],
HaddockProjectFlags -> Flag Bool
haddockProjectHoogle :: Flag Bool,
HaddockProjectFlags -> Flag String
haddockProjectHtmlLocation :: Flag String,
HaddockProjectFlags -> Flag Bool
haddockProjectExecutables :: Flag Bool,
HaddockProjectFlags -> Flag Bool
haddockProjectTestSuites :: Flag Bool,
HaddockProjectFlags -> Flag Bool
haddockProjectBenchmarks :: Flag Bool,
HaddockProjectFlags -> Flag Bool
haddockProjectForeignLibs :: Flag Bool,
HaddockProjectFlags -> Flag Bool
haddockProjectInternal :: Flag Bool,
HaddockProjectFlags -> Flag String
haddockProjectCss :: Flag FilePath,
HaddockProjectFlags -> Flag Bool
haddockProjectLinkedSource :: Flag Bool,
HaddockProjectFlags -> Flag Bool
haddockProjectQuickJump :: Flag Bool,
HaddockProjectFlags -> Flag String
haddockProjectHscolourCss :: Flag FilePath,
HaddockProjectFlags -> Flag Bool
haddockProjectKeepTempFiles:: Flag Bool,
HaddockProjectFlags -> Flag Verbosity
haddockProjectVerbosity :: Flag Verbosity,
HaddockProjectFlags -> Flag String
haddockProjectLib :: Flag String
}
deriving (Int -> HaddockProjectFlags -> String -> String
[HaddockProjectFlags] -> String -> String
HaddockProjectFlags -> String
(Int -> HaddockProjectFlags -> String -> String)
-> (HaddockProjectFlags -> String)
-> ([HaddockProjectFlags] -> String -> String)
-> Show HaddockProjectFlags
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> HaddockProjectFlags -> String -> String
showsPrec :: Int -> HaddockProjectFlags -> String -> String
$cshow :: HaddockProjectFlags -> String
show :: HaddockProjectFlags -> String
$cshowList :: [HaddockProjectFlags] -> String -> String
showList :: [HaddockProjectFlags] -> String -> String
Show, (forall x. HaddockProjectFlags -> Rep HaddockProjectFlags x)
-> (forall x. Rep HaddockProjectFlags x -> HaddockProjectFlags)
-> Generic HaddockProjectFlags
forall x. Rep HaddockProjectFlags x -> HaddockProjectFlags
forall x. HaddockProjectFlags -> Rep HaddockProjectFlags x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. HaddockProjectFlags -> Rep HaddockProjectFlags x
from :: forall x. HaddockProjectFlags -> Rep HaddockProjectFlags x
$cto :: forall x. Rep HaddockProjectFlags x -> HaddockProjectFlags
to :: forall x. Rep HaddockProjectFlags x -> HaddockProjectFlags
Generic, Typeable)
defaultHaddockProjectFlags :: HaddockProjectFlags
defaultHaddockProjectFlags :: HaddockProjectFlags
defaultHaddockProjectFlags = HaddockProjectFlags {
haddockProjectHackage :: Flag Bool
haddockProjectHackage = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
haddockProjectLocal :: Flag Bool
haddockProjectLocal = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
haddockProjectDir :: Flag String
haddockProjectDir = String -> Flag String
forall a. a -> Flag a
Flag String
"./haddocks",
haddockProjectPrologue :: Flag String
haddockProjectPrologue = Flag String
forall a. Flag a
NoFlag,
haddockProjectGenIndex :: Flag Bool
haddockProjectGenIndex = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
haddockProjectGenContents :: Flag Bool
haddockProjectGenContents = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
haddockProjectTestSuites :: Flag Bool
haddockProjectTestSuites = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
haddockProjectProgramPaths :: [(String, String)]
haddockProjectProgramPaths = [(String, String)]
forall a. Monoid a => a
mempty,
haddockProjectProgramArgs :: [(String, [String])]
haddockProjectProgramArgs = [(String, [String])]
forall a. Monoid a => a
mempty,
haddockProjectHoogle :: Flag Bool
haddockProjectHoogle = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
haddockProjectHtmlLocation :: Flag String
haddockProjectHtmlLocation = Flag String
forall a. Flag a
NoFlag,
haddockProjectExecutables :: Flag Bool
haddockProjectExecutables = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
haddockProjectBenchmarks :: Flag Bool
haddockProjectBenchmarks = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
haddockProjectForeignLibs :: Flag Bool
haddockProjectForeignLibs = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
haddockProjectInternal :: Flag Bool
haddockProjectInternal = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
haddockProjectCss :: Flag String
haddockProjectCss = Flag String
forall a. Flag a
NoFlag,
haddockProjectLinkedSource :: Flag Bool
haddockProjectLinkedSource = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
haddockProjectQuickJump :: Flag Bool
haddockProjectQuickJump = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
haddockProjectHscolourCss :: Flag String
haddockProjectHscolourCss = Flag String
forall a. Flag a
NoFlag,
haddockProjectKeepTempFiles :: Flag Bool
haddockProjectKeepTempFiles= Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
haddockProjectVerbosity :: Flag Verbosity
haddockProjectVerbosity = Verbosity -> Flag Verbosity
forall a. a -> Flag a
Flag Verbosity
normal,
haddockProjectLib :: Flag String
haddockProjectLib = Flag String
forall a. Flag a
NoFlag,
haddockProjectInterfaces :: Flag [(String, Maybe String, Maybe String, Visibility)]
haddockProjectInterfaces = Flag [(String, Maybe String, Maybe String, Visibility)]
forall a. Flag a
NoFlag
}
haddockProjectCommand :: CommandUI HaddockProjectFlags
haddockProjectCommand :: CommandUI HaddockProjectFlags
haddockProjectCommand = CommandUI
{ commandName :: String
commandName = String
"v2-haddock-project"
, commandSynopsis :: String
commandSynopsis = String
"Generate Haddocks HTML documentation for the cabal project."
, commandDescription :: Maybe (String -> String)
commandDescription = (String -> String) -> Maybe (String -> String)
forall a. a -> Maybe a
Just ((String -> String) -> Maybe (String -> String))
-> (String -> String) -> Maybe (String -> String)
forall a b. (a -> b) -> a -> b
$ \String
_ ->
String
"Require the programm haddock, version 2.26.\n"
, commandNotes :: Maybe (String -> String)
commandNotes = Maybe (String -> String)
forall a. Maybe a
Nothing
, commandUsage :: String -> String
commandUsage = String -> [String] -> String -> String
usageAlternatives String
"haddocks" ([String] -> String -> String) -> [String] -> String -> String
forall a b. (a -> b) -> a -> b
$
[ String
"[FLAGS]"
, String
"COMPONENTS [FLAGS]"
]
, commandDefaultFlags :: HaddockProjectFlags
commandDefaultFlags = HaddockProjectFlags
defaultHaddockProjectFlags
, commandOptions :: ShowOrParseArgs -> [OptionField HaddockProjectFlags]
commandOptions = \ShowOrParseArgs
showOrParseArgs ->
ShowOrParseArgs -> [OptionField HaddockProjectFlags]
haddockProjectOptions ShowOrParseArgs
showOrParseArgs
[OptionField HaddockProjectFlags]
-> [OptionField HaddockProjectFlags]
-> [OptionField HaddockProjectFlags]
forall a. [a] -> [a] -> [a]
++ ProgramDb
-> ShowOrParseArgs
-> (HaddockProjectFlags -> [(String, String)])
-> ([(String, String)]
-> HaddockProjectFlags -> HaddockProjectFlags)
-> [OptionField HaddockProjectFlags]
forall flags.
ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, String)])
-> ([(String, String)] -> flags -> flags)
-> [OptionField flags]
programDbPaths ProgramDb
progDb ShowOrParseArgs
ParseArgs
HaddockProjectFlags -> [(String, String)]
haddockProjectProgramPaths (\[(String, String)]
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags { haddockProjectProgramPaths = v})
[OptionField HaddockProjectFlags]
-> [OptionField HaddockProjectFlags]
-> [OptionField HaddockProjectFlags]
forall a. [a] -> [a] -> [a]
++ ProgramDb
-> ShowOrParseArgs
-> (HaddockProjectFlags -> [(String, [String])])
-> ([(String, [String])]
-> HaddockProjectFlags -> HaddockProjectFlags)
-> [OptionField HaddockProjectFlags]
forall flags.
ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, [String])])
-> ([(String, [String])] -> flags -> flags)
-> [OptionField flags]
programDbOption ProgramDb
progDb ShowOrParseArgs
showOrParseArgs
HaddockProjectFlags -> [(String, [String])]
haddockProjectProgramArgs (\[(String, [String])]
v HaddockProjectFlags
fs -> HaddockProjectFlags
fs { haddockProjectProgramArgs = v })
[OptionField HaddockProjectFlags]
-> [OptionField HaddockProjectFlags]
-> [OptionField HaddockProjectFlags]
forall a. [a] -> [a] -> [a]
++ ProgramDb
-> ShowOrParseArgs
-> (HaddockProjectFlags -> [(String, [String])])
-> ([(String, [String])]
-> HaddockProjectFlags -> HaddockProjectFlags)
-> [OptionField HaddockProjectFlags]
forall flags.
ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, [String])])
-> ([(String, [String])] -> flags -> flags)
-> [OptionField flags]
programDbOptions ProgramDb
progDb ShowOrParseArgs
ParseArgs
HaddockProjectFlags -> [(String, [String])]
haddockProjectProgramArgs (\[(String, [String])]
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags { haddockProjectProgramArgs = v})
}
where
progDb :: ProgramDb
progDb = Program -> ProgramDb -> ProgramDb
addKnownProgram Program
haddockProgram
(ProgramDb -> ProgramDb) -> ProgramDb -> ProgramDb
forall a b. (a -> b) -> a -> b
$ Program -> ProgramDb -> ProgramDb
addKnownProgram Program
ghcProgram
(ProgramDb -> ProgramDb) -> ProgramDb -> ProgramDb
forall a b. (a -> b) -> a -> b
$ ProgramDb
emptyProgramDb
haddockProjectOptions :: ShowOrParseArgs -> [OptionField HaddockProjectFlags]
haddockProjectOptions :: ShowOrParseArgs -> [OptionField HaddockProjectFlags]
haddockProjectOptions ShowOrParseArgs
_showOrParseArgs =
[String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag Bool)
-> (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
(HaddockProjectFlags -> Flag Bool)
(Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"hackage"]
([String] -> String
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat [String
"A short-cut option to build documentation linked to hackage; "
,String
"it implies --quickjump, --gen-index, --gen-contents, "
,String
"--hyperlinked-source and --html-location"
])
HaddockProjectFlags -> Flag Bool
haddockProjectHackage (\Flag Bool
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags { haddockProjectHackage = v })
MkOptDescr
(HaddockProjectFlags -> Flag Bool)
(Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag Bool)
-> (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
(HaddockProjectFlags -> Flag Bool)
(Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"local"]
([String] -> String
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat [String
"A short-cut option to build self contained documentation; "
,String
"it implies --quickjump, --gen-index, --gen-contents "
,String
"and --hyperlinked-source."
])
HaddockProjectFlags -> Flag Bool
haddockProjectLocal (\Flag Bool
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags { haddockProjectLocal = v })
MkOptDescr
(HaddockProjectFlags -> Flag Bool)
(Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag String)
-> (Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
(HaddockProjectFlags -> Flag String)
(Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"output"]
String
"Output directory"
HaddockProjectFlags -> Flag String
haddockProjectDir (\Flag String
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags { haddockProjectDir = v })
(String
-> (Maybe String -> Flag String)
-> (Flag String -> [Maybe String])
-> MkOptDescr
(HaddockProjectFlags -> Flag String)
(Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
forall b a.
Monoid b =>
String
-> (Maybe String -> b)
-> (b -> [Maybe String])
-> MkOptDescr (a -> b) (b -> a -> a) a
optArg' String
"DIRECTORY" Maybe String -> Flag String
forall a. Maybe a -> Flag a
maybeToFlag ((String -> Maybe String) -> [String] -> [Maybe String]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Maybe String
forall a. a -> Maybe a
Just ([String] -> [Maybe String])
-> (Flag String -> [String]) -> Flag String -> [Maybe String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Flag String -> [String]
forall a. Flag a -> [a]
flagToList))
,String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag String)
-> (Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
(HaddockProjectFlags -> Flag String)
(Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"prologue"]
String
"File path to a prologue file in haddock format"
HaddockProjectFlags -> Flag String
haddockProjectPrologue (\Flag String
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags { haddockProjectPrologue = v})
(String
-> (Maybe String -> Flag String)
-> (Flag String -> [Maybe String])
-> MkOptDescr
(HaddockProjectFlags -> Flag String)
(Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
forall b a.
Monoid b =>
String
-> (Maybe String -> b)
-> (b -> [Maybe String])
-> MkOptDescr (a -> b) (b -> a -> a) a
optArg' String
"PATH" Maybe String -> Flag String
forall a. Maybe a -> Flag a
maybeToFlag ((String -> Maybe String) -> [String] -> [Maybe String]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> Maybe String
forall a. a -> Maybe a
Just ([String] -> [Maybe String])
-> (Flag String -> [String]) -> Flag String -> [Maybe String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Flag String -> [String]
forall a. Flag a -> [a]
flagToList))
,String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag Bool)
-> (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
(HaddockProjectFlags -> Flag Bool)
(Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"gen-index"]
String
"Generate index"
HaddockProjectFlags -> Flag Bool
haddockProjectGenIndex (\Flag Bool
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags { haddockProjectGenIndex = v})
MkOptDescr
(HaddockProjectFlags -> Flag Bool)
(Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag Bool)
-> (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
(HaddockProjectFlags -> Flag Bool)
(Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"gen-contents"]
String
"Generate contents"
HaddockProjectFlags -> Flag Bool
haddockProjectGenContents (\Flag Bool
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags { haddockProjectGenContents = v})
MkOptDescr
(HaddockProjectFlags -> Flag Bool)
(Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag Bool)
-> (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
(HaddockProjectFlags -> Flag Bool)
(Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"hoogle"]
String
"Generate a hoogle database"
HaddockProjectFlags -> Flag Bool
haddockProjectHoogle (\Flag Bool
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags { haddockProjectHoogle = v })
MkOptDescr
(HaddockProjectFlags -> Flag Bool)
(Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag String)
-> (Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
(HaddockProjectFlags -> Flag String)
(Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"html-location"]
String
"Location of HTML documentation for pre-requisite packages"
HaddockProjectFlags -> Flag String
haddockProjectHtmlLocation (\Flag String
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags { haddockProjectHtmlLocation = v })
(String
-> MkOptDescr
(HaddockProjectFlags -> Flag String)
(Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
"URL")
,String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag Bool)
-> (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
(HaddockProjectFlags -> Flag Bool)
(Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"executables"]
String
"Run haddock for Executables targets"
HaddockProjectFlags -> Flag Bool
haddockProjectExecutables (\Flag Bool
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags { haddockProjectExecutables = v })
MkOptDescr
(HaddockProjectFlags -> Flag Bool)
(Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag Bool)
-> (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
(HaddockProjectFlags -> Flag Bool)
(Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"tests"]
String
"Run haddock for Test Suite targets"
HaddockProjectFlags -> Flag Bool
haddockProjectTestSuites (\Flag Bool
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags { haddockProjectTestSuites = v })
MkOptDescr
(HaddockProjectFlags -> Flag Bool)
(Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag Bool)
-> (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
(HaddockProjectFlags -> Flag Bool)
(Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"benchmarks"]
String
"Run haddock for Benchmark targets"
HaddockProjectFlags -> Flag Bool
haddockProjectBenchmarks (\Flag Bool
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags { haddockProjectBenchmarks = v })
MkOptDescr
(HaddockProjectFlags -> Flag Bool)
(Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag Bool)
-> (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
(HaddockProjectFlags -> Flag Bool)
(Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"foreign-libraries"]
String
"Run haddock for Foreign Library targets"
HaddockProjectFlags -> Flag Bool
haddockProjectForeignLibs (\Flag Bool
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags { haddockProjectForeignLibs = v })
MkOptDescr
(HaddockProjectFlags -> Flag Bool)
(Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag Bool)
-> (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
(HaddockProjectFlags -> Flag Bool)
(Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"internal"]
String
"Run haddock for internal modules and include all symbols"
HaddockProjectFlags -> Flag Bool
haddockProjectInternal (\Flag Bool
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags { haddockProjectInternal = v })
MkOptDescr
(HaddockProjectFlags -> Flag Bool)
(Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag String)
-> (Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
(HaddockProjectFlags -> Flag String)
(Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"css"]
String
"Use PATH as the haddock stylesheet"
HaddockProjectFlags -> Flag String
haddockProjectCss (\Flag String
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags { haddockProjectCss = v })
(String
-> MkOptDescr
(HaddockProjectFlags -> Flag String)
(Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
"PATH")
,String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag Bool)
-> (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
(HaddockProjectFlags -> Flag Bool)
(Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"hyperlink-source",String
"hyperlink-sources",String
"hyperlinked-source"]
String
"Hyperlink the documentation to the source code"
HaddockProjectFlags -> Flag Bool
haddockProjectLinkedSource (\Flag Bool
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags { haddockProjectLinkedSource = v })
MkOptDescr
(HaddockProjectFlags -> Flag Bool)
(Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag Bool)
-> (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
(HaddockProjectFlags -> Flag Bool)
(Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"quickjump"]
String
"Generate an index for interactive documentation navigation"
HaddockProjectFlags -> Flag Bool
haddockProjectQuickJump (\Flag Bool
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags { haddockProjectQuickJump = v })
MkOptDescr
(HaddockProjectFlags -> Flag Bool)
(Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag String)
-> (Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
(HaddockProjectFlags -> Flag String)
(Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"hscolour-css"]
String
"Use PATH as the HsColour stylesheet"
HaddockProjectFlags -> Flag String
haddockProjectHscolourCss (\Flag String
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags { haddockProjectHscolourCss = v })
(String
-> MkOptDescr
(HaddockProjectFlags -> Flag String)
(Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
"PATH")
,String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag Bool)
-> (Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
(HaddockProjectFlags -> Flag Bool)
(Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"keep-temp-files"]
String
"Keep temporary files"
HaddockProjectFlags -> Flag Bool
haddockProjectKeepTempFiles (\Flag Bool
b HaddockProjectFlags
flags -> HaddockProjectFlags
flags { haddockProjectKeepTempFiles = b })
MkOptDescr
(HaddockProjectFlags -> Flag Bool)
(Flag Bool -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
,(HaddockProjectFlags -> Flag Verbosity)
-> (Flag Verbosity -> HaddockProjectFlags -> HaddockProjectFlags)
-> OptionField HaddockProjectFlags
forall flags.
(flags -> Flag Verbosity)
-> (Flag Verbosity -> flags -> flags) -> OptionField flags
optionVerbosity HaddockProjectFlags -> Flag Verbosity
haddockProjectVerbosity
(\Flag Verbosity
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags { haddockProjectVerbosity = v })
,String
-> [String]
-> String
-> (HaddockProjectFlags -> Flag String)
-> (Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
-> MkOptDescr
(HaddockProjectFlags -> Flag String)
(Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
-> OptionField HaddockProjectFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"lib"]
String
"location of Haddocks static / auxiliary files"
HaddockProjectFlags -> Flag String
haddockProjectLib (\Flag String
v HaddockProjectFlags
flags -> HaddockProjectFlags
flags { haddockProjectLib = v})
(String
-> MkOptDescr
(HaddockProjectFlags -> Flag String)
(Flag String -> HaddockProjectFlags -> HaddockProjectFlags)
HaddockProjectFlags
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
"DIR")
]
emptyHaddockProjectFlags :: HaddockProjectFlags
emptyHaddockProjectFlags :: HaddockProjectFlags
emptyHaddockProjectFlags = HaddockProjectFlags
forall a. Monoid a => a
mempty
instance Monoid HaddockProjectFlags where
mempty :: HaddockProjectFlags
mempty = HaddockProjectFlags
forall a. (Generic a, GMonoid (Rep a)) => a
gmempty
mappend :: HaddockProjectFlags -> HaddockProjectFlags -> HaddockProjectFlags
mappend = HaddockProjectFlags -> HaddockProjectFlags -> HaddockProjectFlags
forall a. Semigroup a => a -> a -> a
(<>)
instance Semigroup HaddockProjectFlags where
<> :: HaddockProjectFlags -> HaddockProjectFlags -> HaddockProjectFlags
(<>) = HaddockProjectFlags -> HaddockProjectFlags -> HaddockProjectFlags
forall a. (Generic a, GSemigroup (Rep a)) => a -> a -> a
gmappend
data CleanFlags = CleanFlags {
CleanFlags -> Flag Bool
cleanSaveConf :: Flag Bool,
CleanFlags -> Flag String
cleanDistPref :: Flag FilePath,
CleanFlags -> Flag Verbosity
cleanVerbosity :: Flag Verbosity,
CleanFlags -> Flag String
cleanCabalFilePath :: Flag FilePath
}
deriving (Int -> CleanFlags -> String -> String
[CleanFlags] -> String -> String
CleanFlags -> String
(Int -> CleanFlags -> String -> String)
-> (CleanFlags -> String)
-> ([CleanFlags] -> String -> String)
-> Show CleanFlags
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> CleanFlags -> String -> String
showsPrec :: Int -> CleanFlags -> String -> String
$cshow :: CleanFlags -> String
show :: CleanFlags -> String
$cshowList :: [CleanFlags] -> String -> String
showList :: [CleanFlags] -> String -> String
Show, (forall x. CleanFlags -> Rep CleanFlags x)
-> (forall x. Rep CleanFlags x -> CleanFlags) -> Generic CleanFlags
forall x. Rep CleanFlags x -> CleanFlags
forall x. CleanFlags -> Rep CleanFlags x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CleanFlags -> Rep CleanFlags x
from :: forall x. CleanFlags -> Rep CleanFlags x
$cto :: forall x. Rep CleanFlags x -> CleanFlags
to :: forall x. Rep CleanFlags x -> CleanFlags
Generic, Typeable)
defaultCleanFlags :: CleanFlags
defaultCleanFlags :: CleanFlags
defaultCleanFlags = CleanFlags {
cleanSaveConf :: Flag Bool
cleanSaveConf = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
cleanDistPref :: Flag String
cleanDistPref = Flag String
forall a. Flag a
NoFlag,
cleanVerbosity :: Flag Verbosity
cleanVerbosity = Verbosity -> Flag Verbosity
forall a. a -> Flag a
Flag Verbosity
normal,
cleanCabalFilePath :: Flag String
cleanCabalFilePath = Flag String
forall a. Monoid a => a
mempty
}
cleanCommand :: CommandUI CleanFlags
cleanCommand :: CommandUI CleanFlags
cleanCommand = CommandUI
{ commandName :: String
commandName = String
"clean"
, commandSynopsis :: String
commandSynopsis = String
"Clean up after a build."
, commandDescription :: Maybe (String -> String)
commandDescription = (String -> String) -> Maybe (String -> String)
forall a. a -> Maybe a
Just ((String -> String) -> Maybe (String -> String))
-> (String -> String) -> Maybe (String -> String)
forall a b. (a -> b) -> a -> b
$ \String
_ ->
String
"Removes .hi, .o, preprocessed sources, etc.\n"
, commandNotes :: Maybe (String -> String)
commandNotes = Maybe (String -> String)
forall a. Maybe a
Nothing
, commandUsage :: String -> String
commandUsage = \String
pname ->
String
"Usage: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
pname String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" clean [FLAGS]\n"
, commandDefaultFlags :: CleanFlags
commandDefaultFlags = CleanFlags
defaultCleanFlags
, commandOptions :: ShowOrParseArgs -> [OptionField CleanFlags]
commandOptions = \ShowOrParseArgs
showOrParseArgs ->
[(CleanFlags -> Flag Verbosity)
-> (Flag Verbosity -> CleanFlags -> CleanFlags)
-> OptionField CleanFlags
forall flags.
(flags -> Flag Verbosity)
-> (Flag Verbosity -> flags -> flags) -> OptionField flags
optionVerbosity CleanFlags -> Flag Verbosity
cleanVerbosity (\Flag Verbosity
v CleanFlags
flags -> CleanFlags
flags { cleanVerbosity = v })
,(CleanFlags -> Flag String)
-> (Flag String -> CleanFlags -> CleanFlags)
-> ShowOrParseArgs
-> OptionField CleanFlags
forall flags.
(flags -> Flag String)
-> (Flag String -> flags -> flags)
-> ShowOrParseArgs
-> OptionField flags
optionDistPref
CleanFlags -> Flag String
cleanDistPref (\Flag String
d CleanFlags
flags -> CleanFlags
flags { cleanDistPref = d })
ShowOrParseArgs
showOrParseArgs
,String
-> [String]
-> String
-> (CleanFlags -> Flag Bool)
-> (Flag Bool -> CleanFlags -> CleanFlags)
-> MkOptDescr
(CleanFlags -> Flag Bool)
(Flag Bool -> CleanFlags -> CleanFlags)
CleanFlags
-> OptionField CleanFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"s" [String
"save-configure"]
String
"Do not remove the configuration file (dist/setup-config) during cleaning. Saves need to reconfigure."
CleanFlags -> Flag Bool
cleanSaveConf (\Flag Bool
v CleanFlags
flags -> CleanFlags
flags { cleanSaveConf = v })
MkOptDescr
(CleanFlags -> Flag Bool)
(Flag Bool -> CleanFlags -> CleanFlags)
CleanFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
]
}
emptyCleanFlags :: CleanFlags
emptyCleanFlags :: CleanFlags
emptyCleanFlags = CleanFlags
forall a. Monoid a => a
mempty
instance Monoid CleanFlags where
mempty :: CleanFlags
mempty = CleanFlags
forall a. (Generic a, GMonoid (Rep a)) => a
gmempty
mappend :: CleanFlags -> CleanFlags -> CleanFlags
mappend = CleanFlags -> CleanFlags -> CleanFlags
forall a. Semigroup a => a -> a -> a
(<>)
instance Semigroup CleanFlags where
<> :: CleanFlags -> CleanFlags -> CleanFlags
(<>) = CleanFlags -> CleanFlags -> CleanFlags
forall a. (Generic a, GSemigroup (Rep a)) => a -> a -> a
gmappend
data BuildFlags = BuildFlags {
BuildFlags -> [(String, String)]
buildProgramPaths :: [(String, FilePath)],
BuildFlags -> [(String, [String])]
buildProgramArgs :: [(String, [String])],
BuildFlags -> Flag String
buildDistPref :: Flag FilePath,
BuildFlags -> Flag Verbosity
buildVerbosity :: Flag Verbosity,
BuildFlags -> Flag (Maybe Int)
buildNumJobs :: Flag (Maybe Int),
BuildFlags -> [String]
buildArgs :: [String],
BuildFlags -> Flag String
buildCabalFilePath :: Flag FilePath
}
deriving (ReadPrec [BuildFlags]
ReadPrec BuildFlags
Int -> ReadS BuildFlags
ReadS [BuildFlags]
(Int -> ReadS BuildFlags)
-> ReadS [BuildFlags]
-> ReadPrec BuildFlags
-> ReadPrec [BuildFlags]
-> Read BuildFlags
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS BuildFlags
readsPrec :: Int -> ReadS BuildFlags
$creadList :: ReadS [BuildFlags]
readList :: ReadS [BuildFlags]
$creadPrec :: ReadPrec BuildFlags
readPrec :: ReadPrec BuildFlags
$creadListPrec :: ReadPrec [BuildFlags]
readListPrec :: ReadPrec [BuildFlags]
Read, Int -> BuildFlags -> String -> String
[BuildFlags] -> String -> String
BuildFlags -> String
(Int -> BuildFlags -> String -> String)
-> (BuildFlags -> String)
-> ([BuildFlags] -> String -> String)
-> Show BuildFlags
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> BuildFlags -> String -> String
showsPrec :: Int -> BuildFlags -> String -> String
$cshow :: BuildFlags -> String
show :: BuildFlags -> String
$cshowList :: [BuildFlags] -> String -> String
showList :: [BuildFlags] -> String -> String
Show, (forall x. BuildFlags -> Rep BuildFlags x)
-> (forall x. Rep BuildFlags x -> BuildFlags) -> Generic BuildFlags
forall x. Rep BuildFlags x -> BuildFlags
forall x. BuildFlags -> Rep BuildFlags x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. BuildFlags -> Rep BuildFlags x
from :: forall x. BuildFlags -> Rep BuildFlags x
$cto :: forall x. Rep BuildFlags x -> BuildFlags
to :: forall x. Rep BuildFlags x -> BuildFlags
Generic, Typeable)
defaultBuildFlags :: BuildFlags
defaultBuildFlags :: BuildFlags
defaultBuildFlags = BuildFlags {
buildProgramPaths :: [(String, String)]
buildProgramPaths = [(String, String)]
forall a. Monoid a => a
mempty,
buildProgramArgs :: [(String, [String])]
buildProgramArgs = [],
buildDistPref :: Flag String
buildDistPref = Flag String
forall a. Monoid a => a
mempty,
buildVerbosity :: Flag Verbosity
buildVerbosity = Verbosity -> Flag Verbosity
forall a. a -> Flag a
Flag Verbosity
normal,
buildNumJobs :: Flag (Maybe Int)
buildNumJobs = Flag (Maybe Int)
forall a. Monoid a => a
mempty,
buildArgs :: [String]
buildArgs = [],
buildCabalFilePath :: Flag String
buildCabalFilePath = Flag String
forall a. Monoid a => a
mempty
}
buildCommand :: ProgramDb -> CommandUI BuildFlags
buildCommand :: ProgramDb -> CommandUI BuildFlags
buildCommand ProgramDb
progDb = CommandUI
{ commandName :: String
commandName = String
"build"
, commandSynopsis :: String
commandSynopsis = String
"Compile all/specific components."
, commandDescription :: Maybe (String -> String)
commandDescription = (String -> String) -> Maybe (String -> String)
forall a. a -> Maybe a
Just ((String -> String) -> Maybe (String -> String))
-> (String -> String) -> Maybe (String -> String)
forall a b. (a -> b) -> a -> b
$ \String
_ -> String -> String
wrapText (String -> String) -> String -> String
forall a b. (a -> b) -> a -> b
$
String
"Components encompass executables, tests, and benchmarks.\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"Affected by configuration options, see `configure`.\n"
, commandNotes :: Maybe (String -> String)
commandNotes = (String -> String) -> Maybe (String -> String)
forall a. a -> Maybe a
Just ((String -> String) -> Maybe (String -> String))
-> (String -> String) -> Maybe (String -> String)
forall a b. (a -> b) -> a -> b
$ \String
pname ->
String
"Examples:\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
pname String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" build "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" All the components in the package\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
pname String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" build foo "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" A component (i.e. lib, exe, test suite)\n\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ ProgramDb -> String
programFlagsDescription ProgramDb
progDb
, commandUsage :: String -> String
commandUsage = String -> [String] -> String -> String
usageAlternatives String
"build" ([String] -> String -> String) -> [String] -> String -> String
forall a b. (a -> b) -> a -> b
$
[ String
"[FLAGS]"
, String
"COMPONENTS [FLAGS]"
]
, commandDefaultFlags :: BuildFlags
commandDefaultFlags = BuildFlags
defaultBuildFlags
, commandOptions :: ShowOrParseArgs -> [OptionField BuildFlags]
commandOptions = \ShowOrParseArgs
showOrParseArgs ->
[ (BuildFlags -> Flag Verbosity)
-> (Flag Verbosity -> BuildFlags -> BuildFlags)
-> OptionField BuildFlags
forall flags.
(flags -> Flag Verbosity)
-> (Flag Verbosity -> flags -> flags) -> OptionField flags
optionVerbosity
BuildFlags -> Flag Verbosity
buildVerbosity (\Flag Verbosity
v BuildFlags
flags -> BuildFlags
flags { buildVerbosity = v })
, (BuildFlags -> Flag String)
-> (Flag String -> BuildFlags -> BuildFlags)
-> ShowOrParseArgs
-> OptionField BuildFlags
forall flags.
(flags -> Flag String)
-> (Flag String -> flags -> flags)
-> ShowOrParseArgs
-> OptionField flags
optionDistPref
BuildFlags -> Flag String
buildDistPref (\Flag String
d BuildFlags
flags -> BuildFlags
flags { buildDistPref = d }) ShowOrParseArgs
showOrParseArgs
]
[OptionField BuildFlags]
-> [OptionField BuildFlags] -> [OptionField BuildFlags]
forall a. [a] -> [a] -> [a]
++ ProgramDb -> ShowOrParseArgs -> [OptionField BuildFlags]
buildOptions ProgramDb
progDb ShowOrParseArgs
showOrParseArgs
}
buildOptions :: ProgramDb -> ShowOrParseArgs
-> [OptionField BuildFlags]
buildOptions :: ProgramDb -> ShowOrParseArgs -> [OptionField BuildFlags]
buildOptions ProgramDb
progDb ShowOrParseArgs
showOrParseArgs =
[ (BuildFlags -> Flag (Maybe Int))
-> (Flag (Maybe Int) -> BuildFlags -> BuildFlags)
-> OptionField BuildFlags
forall flags.
(flags -> Flag (Maybe Int))
-> (Flag (Maybe Int) -> flags -> flags) -> OptionField flags
optionNumJobs
BuildFlags -> Flag (Maybe Int)
buildNumJobs (\Flag (Maybe Int)
v BuildFlags
flags -> BuildFlags
flags { buildNumJobs = v })
]
[OptionField BuildFlags]
-> [OptionField BuildFlags] -> [OptionField BuildFlags]
forall a. [a] -> [a] -> [a]
++ ProgramDb
-> ShowOrParseArgs
-> (BuildFlags -> [(String, String)])
-> ([(String, String)] -> BuildFlags -> BuildFlags)
-> [OptionField BuildFlags]
forall flags.
ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, String)])
-> ([(String, String)] -> flags -> flags)
-> [OptionField flags]
programDbPaths ProgramDb
progDb ShowOrParseArgs
showOrParseArgs
BuildFlags -> [(String, String)]
buildProgramPaths (\[(String, String)]
v BuildFlags
flags -> BuildFlags
flags { buildProgramPaths = v})
[OptionField BuildFlags]
-> [OptionField BuildFlags] -> [OptionField BuildFlags]
forall a. [a] -> [a] -> [a]
++ ProgramDb
-> ShowOrParseArgs
-> (BuildFlags -> [(String, [String])])
-> ([(String, [String])] -> BuildFlags -> BuildFlags)
-> [OptionField BuildFlags]
forall flags.
ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, [String])])
-> ([(String, [String])] -> flags -> flags)
-> [OptionField flags]
programDbOption ProgramDb
progDb ShowOrParseArgs
showOrParseArgs
BuildFlags -> [(String, [String])]
buildProgramArgs (\[(String, [String])]
v BuildFlags
fs -> BuildFlags
fs { buildProgramArgs = v })
[OptionField BuildFlags]
-> [OptionField BuildFlags] -> [OptionField BuildFlags]
forall a. [a] -> [a] -> [a]
++ ProgramDb
-> ShowOrParseArgs
-> (BuildFlags -> [(String, [String])])
-> ([(String, [String])] -> BuildFlags -> BuildFlags)
-> [OptionField BuildFlags]
forall flags.
ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, [String])])
-> ([(String, [String])] -> flags -> flags)
-> [OptionField flags]
programDbOptions ProgramDb
progDb ShowOrParseArgs
showOrParseArgs
BuildFlags -> [(String, [String])]
buildProgramArgs (\[(String, [String])]
v BuildFlags
flags -> BuildFlags
flags { buildProgramArgs = v})
emptyBuildFlags :: BuildFlags
emptyBuildFlags :: BuildFlags
emptyBuildFlags = BuildFlags
forall a. Monoid a => a
mempty
instance Monoid BuildFlags where
mempty :: BuildFlags
mempty = BuildFlags
forall a. (Generic a, GMonoid (Rep a)) => a
gmempty
mappend :: BuildFlags -> BuildFlags -> BuildFlags
mappend = BuildFlags -> BuildFlags -> BuildFlags
forall a. Semigroup a => a -> a -> a
(<>)
instance Semigroup BuildFlags where
<> :: BuildFlags -> BuildFlags -> BuildFlags
(<>) = BuildFlags -> BuildFlags -> BuildFlags
forall a. (Generic a, GSemigroup (Rep a)) => a -> a -> a
gmappend
data ReplOptions = ReplOptions {
ReplOptions -> [String]
replOptionsFlags :: [String],
ReplOptions -> Flag Bool
replOptionsNoLoad :: Flag Bool
}
deriving (Int -> ReplOptions -> String -> String
[ReplOptions] -> String -> String
ReplOptions -> String
(Int -> ReplOptions -> String -> String)
-> (ReplOptions -> String)
-> ([ReplOptions] -> String -> String)
-> Show ReplOptions
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> ReplOptions -> String -> String
showsPrec :: Int -> ReplOptions -> String -> String
$cshow :: ReplOptions -> String
show :: ReplOptions -> String
$cshowList :: [ReplOptions] -> String -> String
showList :: [ReplOptions] -> String -> String
Show, (forall x. ReplOptions -> Rep ReplOptions x)
-> (forall x. Rep ReplOptions x -> ReplOptions)
-> Generic ReplOptions
forall x. Rep ReplOptions x -> ReplOptions
forall x. ReplOptions -> Rep ReplOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ReplOptions -> Rep ReplOptions x
from :: forall x. ReplOptions -> Rep ReplOptions x
$cto :: forall x. Rep ReplOptions x -> ReplOptions
to :: forall x. Rep ReplOptions x -> ReplOptions
Generic, Typeable)
instance Binary ReplOptions
instance Structured ReplOptions
instance Monoid ReplOptions where
mempty :: ReplOptions
mempty = [String] -> Flag Bool -> ReplOptions
ReplOptions [String]
forall a. Monoid a => a
mempty (Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False)
mappend :: ReplOptions -> ReplOptions -> ReplOptions
mappend = ReplOptions -> ReplOptions -> ReplOptions
forall a. Semigroup a => a -> a -> a
(<>)
instance Semigroup ReplOptions where
<> :: ReplOptions -> ReplOptions -> ReplOptions
(<>) = ReplOptions -> ReplOptions -> ReplOptions
forall a. (Generic a, GSemigroup (Rep a)) => a -> a -> a
gmappend
data ReplFlags = ReplFlags {
ReplFlags -> [(String, String)]
replProgramPaths :: [(String, FilePath)],
ReplFlags -> [(String, [String])]
replProgramArgs :: [(String, [String])],
ReplFlags -> Flag String
replDistPref :: Flag FilePath,
ReplFlags -> Flag Verbosity
replVerbosity :: Flag Verbosity,
ReplFlags -> Flag Bool
replReload :: Flag Bool,
ReplFlags -> ReplOptions
replReplOptions :: ReplOptions
}
deriving (Int -> ReplFlags -> String -> String
[ReplFlags] -> String -> String
ReplFlags -> String
(Int -> ReplFlags -> String -> String)
-> (ReplFlags -> String)
-> ([ReplFlags] -> String -> String)
-> Show ReplFlags
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> ReplFlags -> String -> String
showsPrec :: Int -> ReplFlags -> String -> String
$cshow :: ReplFlags -> String
show :: ReplFlags -> String
$cshowList :: [ReplFlags] -> String -> String
showList :: [ReplFlags] -> String -> String
Show, (forall x. ReplFlags -> Rep ReplFlags x)
-> (forall x. Rep ReplFlags x -> ReplFlags) -> Generic ReplFlags
forall x. Rep ReplFlags x -> ReplFlags
forall x. ReplFlags -> Rep ReplFlags x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ReplFlags -> Rep ReplFlags x
from :: forall x. ReplFlags -> Rep ReplFlags x
$cto :: forall x. Rep ReplFlags x -> ReplFlags
to :: forall x. Rep ReplFlags x -> ReplFlags
Generic, Typeable)
defaultReplFlags :: ReplFlags
defaultReplFlags :: ReplFlags
defaultReplFlags = ReplFlags {
replProgramPaths :: [(String, String)]
replProgramPaths = [(String, String)]
forall a. Monoid a => a
mempty,
replProgramArgs :: [(String, [String])]
replProgramArgs = [],
replDistPref :: Flag String
replDistPref = Flag String
forall a. Flag a
NoFlag,
replVerbosity :: Flag Verbosity
replVerbosity = Verbosity -> Flag Verbosity
forall a. a -> Flag a
Flag Verbosity
normal,
replReload :: Flag Bool
replReload = Bool -> Flag Bool
forall a. a -> Flag a
Flag Bool
False,
replReplOptions :: ReplOptions
replReplOptions = ReplOptions
forall a. Monoid a => a
mempty
}
instance Monoid ReplFlags where
mempty :: ReplFlags
mempty = ReplFlags
forall a. (Generic a, GMonoid (Rep a)) => a
gmempty
mappend :: ReplFlags -> ReplFlags -> ReplFlags
mappend = ReplFlags -> ReplFlags -> ReplFlags
forall a. Semigroup a => a -> a -> a
(<>)
instance Semigroup ReplFlags where
<> :: ReplFlags -> ReplFlags -> ReplFlags
(<>) = ReplFlags -> ReplFlags -> ReplFlags
forall a. (Generic a, GSemigroup (Rep a)) => a -> a -> a
gmappend
replCommand :: ProgramDb -> CommandUI ReplFlags
replCommand :: ProgramDb -> CommandUI ReplFlags
replCommand ProgramDb
progDb = CommandUI
{ commandName :: String
commandName = String
"repl"
, commandSynopsis :: String
commandSynopsis =
String
"Open an interpreter session for the given component."
, commandDescription :: Maybe (String -> String)
commandDescription = (String -> String) -> Maybe (String -> String)
forall a. a -> Maybe a
Just ((String -> String) -> Maybe (String -> String))
-> (String -> String) -> Maybe (String -> String)
forall a b. (a -> b) -> a -> b
$ \String
pname -> String -> String
wrapText (String -> String) -> String -> String
forall a b. (a -> b) -> a -> b
$
String
"If the current directory contains no package, ignores COMPONENT "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"parameters and opens an interactive interpreter session; if a "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"sandbox is present, its package database will be used.\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"Otherwise, (re)configures with the given or default flags, and "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"loads the interpreter with the relevant modules. For executables, "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"tests and benchmarks, loads the main module (and its "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"dependencies); for libraries all exposed/other modules.\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"The default component is the library itself, or the executable "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"if that is the only component.\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"Support for loading specific modules is planned but not "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"implemented yet. For certain scenarios, `" String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
pname
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" exec -- ghci :l Foo` may be used instead. Note that `exec` will "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"not (re)configure and you will have to specify the location of "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"other modules, if required.\n"
, commandNotes :: Maybe (String -> String)
commandNotes = (String -> String) -> Maybe (String -> String)
forall a. a -> Maybe a
Just ((String -> String) -> Maybe (String -> String))
-> (String -> String) -> Maybe (String -> String)
forall a b. (a -> b) -> a -> b
$ \String
pname ->
String
"Examples:\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
pname String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" repl "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" The first component in the package\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
pname String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" repl foo "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" A named component (i.e. lib, exe, test suite)\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
pname String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" repl --repl-options=\"-lstdc++\""
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" Specifying flags for interpreter\n"
, commandUsage :: String -> String
commandUsage = \String
pname -> String
"Usage: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
pname String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" repl [COMPONENT] [FLAGS]\n"
, commandDefaultFlags :: ReplFlags
commandDefaultFlags = ReplFlags
defaultReplFlags
, commandOptions :: ShowOrParseArgs -> [OptionField ReplFlags]
commandOptions = \ShowOrParseArgs
showOrParseArgs ->
(ReplFlags -> Flag Verbosity)
-> (Flag Verbosity -> ReplFlags -> ReplFlags)
-> OptionField ReplFlags
forall flags.
(flags -> Flag Verbosity)
-> (Flag Verbosity -> flags -> flags) -> OptionField flags
optionVerbosity ReplFlags -> Flag Verbosity
replVerbosity (\Flag Verbosity
v ReplFlags
flags -> ReplFlags
flags { replVerbosity = v })
OptionField ReplFlags
-> [OptionField ReplFlags] -> [OptionField ReplFlags]
forall a. a -> [a] -> [a]
: (ReplFlags -> Flag String)
-> (Flag String -> ReplFlags -> ReplFlags)
-> ShowOrParseArgs
-> OptionField ReplFlags
forall flags.
(flags -> Flag String)
-> (Flag String -> flags -> flags)
-> ShowOrParseArgs
-> OptionField flags
optionDistPref
ReplFlags -> Flag String
replDistPref (\Flag String
d ReplFlags
flags -> ReplFlags
flags { replDistPref = d })
ShowOrParseArgs
showOrParseArgs
OptionField ReplFlags
-> [OptionField ReplFlags] -> [OptionField ReplFlags]
forall a. a -> [a] -> [a]
: ProgramDb
-> ShowOrParseArgs
-> (ReplFlags -> [(String, String)])
-> ([(String, String)] -> ReplFlags -> ReplFlags)
-> [OptionField ReplFlags]
forall flags.
ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, String)])
-> ([(String, String)] -> flags -> flags)
-> [OptionField flags]
programDbPaths ProgramDb
progDb ShowOrParseArgs
showOrParseArgs
ReplFlags -> [(String, String)]
replProgramPaths (\[(String, String)]
v ReplFlags
flags -> ReplFlags
flags { replProgramPaths = v})
[OptionField ReplFlags]
-> [OptionField ReplFlags] -> [OptionField ReplFlags]
forall a. [a] -> [a] -> [a]
++ ProgramDb
-> ShowOrParseArgs
-> (ReplFlags -> [(String, [String])])
-> ([(String, [String])] -> ReplFlags -> ReplFlags)
-> [OptionField ReplFlags]
forall flags.
ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, [String])])
-> ([(String, [String])] -> flags -> flags)
-> [OptionField flags]
programDbOption ProgramDb
progDb ShowOrParseArgs
showOrParseArgs
ReplFlags -> [(String, [String])]
replProgramArgs (\[(String, [String])]
v ReplFlags
flags -> ReplFlags
flags { replProgramArgs = v})
[OptionField ReplFlags]
-> [OptionField ReplFlags] -> [OptionField ReplFlags]
forall a. [a] -> [a] -> [a]
++ ProgramDb
-> ShowOrParseArgs
-> (ReplFlags -> [(String, [String])])
-> ([(String, [String])] -> ReplFlags -> ReplFlags)
-> [OptionField ReplFlags]
forall flags.
ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, [String])])
-> ([(String, [String])] -> flags -> flags)
-> [OptionField flags]
programDbOptions ProgramDb
progDb ShowOrParseArgs
showOrParseArgs
ReplFlags -> [(String, [String])]
replProgramArgs (\[(String, [String])]
v ReplFlags
flags -> ReplFlags
flags { replProgramArgs = v})
[OptionField ReplFlags]
-> [OptionField ReplFlags] -> [OptionField ReplFlags]
forall a. [a] -> [a] -> [a]
++ case ShowOrParseArgs
showOrParseArgs of
ShowOrParseArgs
ParseArgs ->
[ String
-> [String]
-> String
-> (ReplFlags -> Flag Bool)
-> (Flag Bool -> ReplFlags -> ReplFlags)
-> MkOptDescr
(ReplFlags -> Flag Bool)
(Flag Bool -> ReplFlags -> ReplFlags)
ReplFlags
-> OptionField ReplFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
"reload"]
String
"Used from within an interpreter to update files."
ReplFlags -> Flag Bool
replReload (\Flag Bool
v ReplFlags
flags -> ReplFlags
flags { replReload = v })
MkOptDescr
(ReplFlags -> Flag Bool)
(Flag Bool -> ReplFlags -> ReplFlags)
ReplFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
]
ShowOrParseArgs
_ -> []
[OptionField ReplFlags]
-> [OptionField ReplFlags] -> [OptionField ReplFlags]
forall a. [a] -> [a] -> [a]
++ (OptionField ReplOptions -> OptionField ReplFlags)
-> [OptionField ReplOptions] -> [OptionField ReplFlags]
forall a b. (a -> b) -> [a] -> [b]
map OptionField ReplOptions -> OptionField ReplFlags
liftReplOption (ShowOrParseArgs -> [OptionField ReplOptions]
replOptions ShowOrParseArgs
showOrParseArgs)
}
where
liftReplOption :: OptionField ReplOptions -> OptionField ReplFlags
liftReplOption = (ReplFlags -> ReplOptions)
-> (ReplOptions -> ReplFlags -> ReplFlags)
-> OptionField ReplOptions
-> OptionField ReplFlags
forall b a.
(b -> a) -> (a -> b -> b) -> OptionField a -> OptionField b
liftOption ReplFlags -> ReplOptions
replReplOptions (\ReplOptions
v ReplFlags
flags -> ReplFlags
flags { replReplOptions = v })
replOptions :: ShowOrParseArgs -> [OptionField ReplOptions]
replOptions :: ShowOrParseArgs -> [OptionField ReplOptions]
replOptions ShowOrParseArgs
_ =
[ String
-> [String]
-> String
-> (ReplOptions -> Flag Bool)
-> (Flag Bool -> ReplOptions -> ReplOptions)
-> MkOptDescr
(ReplOptions -> Flag Bool)
(Flag Bool -> ReplOptions -> ReplOptions)
ReplOptions
-> OptionField ReplOptions
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option [] [String
"repl-no-load"]
String
"Disable loading of project modules at REPL startup."
ReplOptions -> Flag Bool
replOptionsNoLoad (\Flag Bool
p ReplOptions
flags -> ReplOptions
flags { replOptionsNoLoad = p })
MkOptDescr
(ReplOptions -> Flag Bool)
(Flag Bool -> ReplOptions -> ReplOptions)
ReplOptions
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
, String
-> [String]
-> String
-> (ReplOptions -> [String])
-> ([String] -> ReplOptions -> ReplOptions)
-> MkOptDescr
(ReplOptions -> [String])
([String] -> ReplOptions -> ReplOptions)
ReplOptions
-> OptionField ReplOptions
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option [] [String
"repl-options"]
String
"Use the option(s) for the repl"
ReplOptions -> [String]
replOptionsFlags (\[String]
p ReplOptions
flags -> ReplOptions
flags { replOptionsFlags = p })
(String
-> ReadE [String]
-> ([String] -> [String])
-> MkOptDescr
(ReplOptions -> [String])
([String] -> ReplOptions -> ReplOptions)
ReplOptions
forall b a.
Monoid b =>
String
-> ReadE b
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg String
"FLAG" ((String -> [String]) -> ReadE [String]
forall a. (String -> a) -> ReadE a
succeedReadE String -> [String]
words) [String] -> [String]
forall a. a -> a
id)
]
data TestShowDetails = Never | Failures | Always | Streaming | Direct
deriving (TestShowDetails -> TestShowDetails -> Bool
(TestShowDetails -> TestShowDetails -> Bool)
-> (TestShowDetails -> TestShowDetails -> Bool)
-> Eq TestShowDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TestShowDetails -> TestShowDetails -> Bool
== :: TestShowDetails -> TestShowDetails -> Bool
$c/= :: TestShowDetails -> TestShowDetails -> Bool
/= :: TestShowDetails -> TestShowDetails -> Bool
Eq, Eq TestShowDetails
Eq TestShowDetails =>
(TestShowDetails -> TestShowDetails -> Ordering)
-> (TestShowDetails -> TestShowDetails -> Bool)
-> (TestShowDetails -> TestShowDetails -> Bool)
-> (TestShowDetails -> TestShowDetails -> Bool)
-> (TestShowDetails -> TestShowDetails -> Bool)
-> (TestShowDetails -> TestShowDetails -> TestShowDetails)
-> (TestShowDetails -> TestShowDetails -> TestShowDetails)
-> Ord TestShowDetails
TestShowDetails -> TestShowDetails -> Bool
TestShowDetails -> TestShowDetails -> Ordering
TestShowDetails -> TestShowDetails -> TestShowDetails
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: TestShowDetails -> TestShowDetails -> Ordering
compare :: TestShowDetails -> TestShowDetails -> Ordering
$c< :: TestShowDetails -> TestShowDetails -> Bool
< :: TestShowDetails -> TestShowDetails -> Bool
$c<= :: TestShowDetails -> TestShowDetails -> Bool
<= :: TestShowDetails -> TestShowDetails -> Bool
$c> :: TestShowDetails -> TestShowDetails -> Bool
> :: TestShowDetails -> TestShowDetails -> Bool
$c>= :: TestShowDetails -> TestShowDetails -> Bool
>= :: TestShowDetails -> TestShowDetails -> Bool
$cmax :: TestShowDetails -> TestShowDetails -> TestShowDetails
max :: TestShowDetails -> TestShowDetails -> TestShowDetails
$cmin :: TestShowDetails -> TestShowDetails -> TestShowDetails
min :: TestShowDetails -> TestShowDetails -> TestShowDetails
Ord, Int -> TestShowDetails
TestShowDetails -> Int
TestShowDetails -> [TestShowDetails]
TestShowDetails -> TestShowDetails
TestShowDetails -> TestShowDetails -> [TestShowDetails]
TestShowDetails
-> TestShowDetails -> TestShowDetails -> [TestShowDetails]
(TestShowDetails -> TestShowDetails)
-> (TestShowDetails -> TestShowDetails)
-> (Int -> TestShowDetails)
-> (TestShowDetails -> Int)
-> (TestShowDetails -> [TestShowDetails])
-> (TestShowDetails -> TestShowDetails -> [TestShowDetails])
-> (TestShowDetails -> TestShowDetails -> [TestShowDetails])
-> (TestShowDetails
-> TestShowDetails -> TestShowDetails -> [TestShowDetails])
-> Enum TestShowDetails
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: TestShowDetails -> TestShowDetails
succ :: TestShowDetails -> TestShowDetails
$cpred :: TestShowDetails -> TestShowDetails
pred :: TestShowDetails -> TestShowDetails
$ctoEnum :: Int -> TestShowDetails
toEnum :: Int -> TestShowDetails
$cfromEnum :: TestShowDetails -> Int
fromEnum :: TestShowDetails -> Int
$cenumFrom :: TestShowDetails -> [TestShowDetails]
enumFrom :: TestShowDetails -> [TestShowDetails]
$cenumFromThen :: TestShowDetails -> TestShowDetails -> [TestShowDetails]
enumFromThen :: TestShowDetails -> TestShowDetails -> [TestShowDetails]
$cenumFromTo :: TestShowDetails -> TestShowDetails -> [TestShowDetails]
enumFromTo :: TestShowDetails -> TestShowDetails -> [TestShowDetails]
$cenumFromThenTo :: TestShowDetails
-> TestShowDetails -> TestShowDetails -> [TestShowDetails]
enumFromThenTo :: TestShowDetails
-> TestShowDetails -> TestShowDetails -> [TestShowDetails]
Enum, TestShowDetails
TestShowDetails -> TestShowDetails -> Bounded TestShowDetails
forall a. a -> a -> Bounded a
$cminBound :: TestShowDetails
minBound :: TestShowDetails
$cmaxBound :: TestShowDetails
maxBound :: TestShowDetails
Bounded, (forall x. TestShowDetails -> Rep TestShowDetails x)
-> (forall x. Rep TestShowDetails x -> TestShowDetails)
-> Generic TestShowDetails
forall x. Rep TestShowDetails x -> TestShowDetails
forall x. TestShowDetails -> Rep TestShowDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TestShowDetails -> Rep TestShowDetails x
from :: forall x. TestShowDetails -> Rep TestShowDetails x
$cto :: forall x. Rep TestShowDetails x -> TestShowDetails
to :: forall x. Rep TestShowDetails x -> TestShowDetails
Generic, Int -> TestShowDetails -> String -> String
[TestShowDetails] -> String -> String
TestShowDetails -> String
(Int -> TestShowDetails -> String -> String)
-> (TestShowDetails -> String)
-> ([TestShowDetails] -> String -> String)
-> Show TestShowDetails
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> TestShowDetails -> String -> String
showsPrec :: Int -> TestShowDetails -> String -> String
$cshow :: TestShowDetails -> String
show :: TestShowDetails -> String
$cshowList :: [TestShowDetails] -> String -> String
showList :: [TestShowDetails] -> String -> String
Show, Typeable)
instance Binary TestShowDetails
instance Structured TestShowDetails
knownTestShowDetails :: [TestShowDetails]
knownTestShowDetails :: [TestShowDetails]
knownTestShowDetails = [TestShowDetails
forall a. Bounded a => a
minBound..TestShowDetails
forall a. Bounded a => a
maxBound]
instance Pretty TestShowDetails where
pretty :: TestShowDetails -> Doc
pretty = String -> Doc
Disp.text (String -> Doc)
-> (TestShowDetails -> String) -> TestShowDetails -> Doc
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> String
lowercase (String -> String)
-> (TestShowDetails -> String) -> TestShowDetails -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TestShowDetails -> String
forall a. Show a => a -> String
show
instance Parsec TestShowDetails where
parsec :: forall (m :: * -> *). CabalParsing m => m TestShowDetails
parsec = m TestShowDetails
-> (TestShowDetails -> m TestShowDetails)
-> Maybe TestShowDetails
-> m TestShowDetails
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (String -> m TestShowDetails
forall a. String -> m a
forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"invalid TestShowDetails") TestShowDetails -> m TestShowDetails
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe TestShowDetails -> m TestShowDetails)
-> (String -> Maybe TestShowDetails) -> String -> m TestShowDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Maybe TestShowDetails
classify (String -> m TestShowDetails) -> m String -> m TestShowDetails
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< m String
ident
where
ident :: m String
ident = (Char -> Bool) -> m String
forall (m :: * -> *). CharParsing m => (Char -> Bool) -> m String
P.munch1 (\Char
c -> Char -> Bool
isAlpha Char
c Bool -> Bool -> Bool
|| Char
c Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
== Char
'_' Bool -> Bool -> Bool
|| Char
c Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
== Char
'-')
classify :: String -> Maybe TestShowDetails
classify String
str = String -> [(String, TestShowDetails)] -> Maybe TestShowDetails
forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup (String -> String
lowercase String
str) [(String, TestShowDetails)]
enumMap
enumMap :: [(String, TestShowDetails)]
enumMap :: [(String, TestShowDetails)]
enumMap = [ (TestShowDetails -> String
forall a. Pretty a => a -> String
prettyShow TestShowDetails
x, TestShowDetails
x)
| TestShowDetails
x <- [TestShowDetails]
knownTestShowDetails ]
instance Monoid TestShowDetails where
mempty :: TestShowDetails
mempty = TestShowDetails
Never
mappend :: TestShowDetails -> TestShowDetails -> TestShowDetails
mappend = TestShowDetails -> TestShowDetails -> TestShowDetails
forall a. Semigroup a => a -> a -> a
(<>)
instance Semigroup TestShowDetails where
TestShowDetails
a <> :: TestShowDetails -> TestShowDetails -> TestShowDetails
<> TestShowDetails
b = if TestShowDetails
a TestShowDetails -> TestShowDetails -> Bool
forall a. Ord a => a -> a -> Bool
< TestShowDetails
b then TestShowDetails
b else TestShowDetails
a
data TestFlags = TestFlags {
TestFlags -> Flag String
testDistPref :: Flag FilePath,
TestFlags -> Flag Verbosity
testVerbosity :: Flag Verbosity,
TestFlags -> Flag PathTemplate
testHumanLog :: Flag PathTemplate,
TestFlags -> Flag PathTemplate
testMachineLog :: Flag PathTemplate,
TestFlags -> Flag TestShowDetails
testShowDetails :: Flag TestShowDetails,
TestFlags -> Flag Bool
testKeepTix :: Flag Bool,
TestFlags -> Flag String
testWrapper :: Flag FilePath,
TestFlags -> Flag Bool
testFailWhenNoTestSuites :: Flag Bool,
TestFlags -> [PathTemplate]
testOptions :: [PathTemplate]
} deriving (Int -> TestFlags -> String -> String
[TestFlags] -> String -> String
TestFlags -> String
(Int -> TestFlags -> String -> String)
-> (TestFlags -> String)
-> ([TestFlags] -> String -> String)
-> Show TestFlags
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> TestFlags -> String -> String
showsPrec :: Int -> TestFlags -> String -> String
$cshow :: TestFlags -> String
show :: TestFlags -> String
$cshowList :: [TestFlags] -> String -> String
showList :: [TestFlags] -> String -> String
Show, (forall x. TestFlags -> Rep TestFlags x)
-> (forall x. Rep TestFlags x -> TestFlags) -> Generic TestFlags
forall x. Rep TestFlags x -> TestFlags
forall x. TestFlags -> Rep TestFlags x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TestFlags -> Rep TestFlags x
from :: forall x. TestFlags -> Rep TestFlags x
$cto :: forall x. Rep TestFlags x -> TestFlags
to :: forall x. Rep TestFlags x -> TestFlags
Generic, Typeable)
defaultTestFlags :: TestFlags
defaultTestFlags :: TestFlags
defaultTestFlags = TestFlags {
testDistPref :: Flag String
testDistPref = Flag String
forall a. Flag a
NoFlag,
testVerbosity :: Flag Verbosity
testVerbosity = Verbosity -> Flag Verbosity
forall a. a -> Flag a
Flag Verbosity
normal,
testHumanLog :: Flag PathTemplate
testHumanLog = PathTemplate -> Flag PathTemplate
forall a. a -> Flag a
toFlag (PathTemplate -> Flag PathTemplate)
-> PathTemplate -> Flag PathTemplate
forall a b. (a -> b) -> a -> b
$ String -> PathTemplate
toPathTemplate (String -> PathTemplate) -> String -> PathTemplate
forall a b. (a -> b) -> a -> b
$ String
"$pkgid-$test-suite.log",
testMachineLog :: Flag PathTemplate
testMachineLog = PathTemplate -> Flag PathTemplate
forall a. a -> Flag a
toFlag (PathTemplate -> Flag PathTemplate)
-> PathTemplate -> Flag PathTemplate
forall a b. (a -> b) -> a -> b
$ String -> PathTemplate
toPathTemplate (String -> PathTemplate) -> String -> PathTemplate
forall a b. (a -> b) -> a -> b
$ String
"$pkgid.log",
testShowDetails :: Flag TestShowDetails
testShowDetails = TestShowDetails -> Flag TestShowDetails
forall a. a -> Flag a
toFlag TestShowDetails
Failures,
testKeepTix :: Flag Bool
testKeepTix = Bool -> Flag Bool
forall a. a -> Flag a
toFlag Bool
False,
testWrapper :: Flag String
testWrapper = Flag String
forall a. Flag a
NoFlag,
testFailWhenNoTestSuites :: Flag Bool
testFailWhenNoTestSuites = Bool -> Flag Bool
forall a. a -> Flag a
toFlag Bool
False,
testOptions :: [PathTemplate]
testOptions = []
}
testCommand :: CommandUI TestFlags
testCommand :: CommandUI TestFlags
testCommand = CommandUI
{ commandName :: String
commandName = String
"test"
, commandSynopsis :: String
commandSynopsis =
String
"Run all/specific tests in the test suite."
, commandDescription :: Maybe (String -> String)
commandDescription = (String -> String) -> Maybe (String -> String)
forall a. a -> Maybe a
Just ((String -> String) -> Maybe (String -> String))
-> (String -> String) -> Maybe (String -> String)
forall a b. (a -> b) -> a -> b
$ \ String
_pname -> String -> String
wrapText (String -> String) -> String -> String
forall a b. (a -> b) -> a -> b
$
String -> String
testOrBenchmarkHelpText String
"test"
, commandNotes :: Maybe (String -> String)
commandNotes = Maybe (String -> String)
forall a. Maybe a
Nothing
, commandUsage :: String -> String
commandUsage = String -> [String] -> String -> String
usageAlternatives String
"test"
[ String
"[FLAGS]"
, String
"TESTCOMPONENTS [FLAGS]"
]
, commandDefaultFlags :: TestFlags
commandDefaultFlags = TestFlags
defaultTestFlags
, commandOptions :: ShowOrParseArgs -> [OptionField TestFlags]
commandOptions = ShowOrParseArgs -> [OptionField TestFlags]
testOptions'
}
testOrBenchmarkHelpText
:: String
-> String
testOrBenchmarkHelpText :: String -> String
testOrBenchmarkHelpText String
s = [String] -> String
unlines ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$ ([String] -> String) -> [[String]] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map [String] -> String
unwords
[ [ String
"The package must have been build with configuration"
, [String] -> String
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat [ String
"flag `--enable-", String
s, String
"s`." ]
]
, []
, [ [String] -> String
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat [ String
"Note that additional dependencies of the ", String
s, String
"s" ]
, String
"must have already been installed."
]
, []
, [ String
"By defining UserHooks in a custom Setup.hs, the package can define"
, [String] -> String
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat [ String
"actions to be executed before and after running ", String
s, String
"s." ]
]
]
testOptions' :: ShowOrParseArgs -> [OptionField TestFlags]
testOptions' :: ShowOrParseArgs -> [OptionField TestFlags]
testOptions' ShowOrParseArgs
showOrParseArgs =
[ (TestFlags -> Flag Verbosity)
-> (Flag Verbosity -> TestFlags -> TestFlags)
-> OptionField TestFlags
forall flags.
(flags -> Flag Verbosity)
-> (Flag Verbosity -> flags -> flags) -> OptionField flags
optionVerbosity TestFlags -> Flag Verbosity
testVerbosity (\Flag Verbosity
v TestFlags
flags -> TestFlags
flags { testVerbosity = v })
, (TestFlags -> Flag String)
-> (Flag String -> TestFlags -> TestFlags)
-> ShowOrParseArgs
-> OptionField TestFlags
forall flags.
(flags -> Flag String)
-> (Flag String -> flags -> flags)
-> ShowOrParseArgs
-> OptionField flags
optionDistPref
TestFlags -> Flag String
testDistPref (\Flag String
d TestFlags
flags -> TestFlags
flags { testDistPref = d })
ShowOrParseArgs
showOrParseArgs
, String
-> [String]
-> String
-> (TestFlags -> Flag PathTemplate)
-> (Flag PathTemplate -> TestFlags -> TestFlags)
-> MkOptDescr
(TestFlags -> Flag PathTemplate)
(Flag PathTemplate -> TestFlags -> TestFlags)
TestFlags
-> OptionField TestFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option [] [String
"log"]
(String
"Log all test suite results to file (name template can use "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"$pkgid, $compiler, $os, $arch, $test-suite, $result)")
TestFlags -> Flag PathTemplate
testHumanLog (\Flag PathTemplate
v TestFlags
flags -> TestFlags
flags { testHumanLog = v })
(String
-> (String -> Flag PathTemplate)
-> (Flag PathTemplate -> [String])
-> MkOptDescr
(TestFlags -> Flag PathTemplate)
(Flag PathTemplate -> TestFlags -> TestFlags)
TestFlags
forall b a.
Monoid b =>
String
-> (String -> b)
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg' String
"TEMPLATE"
(PathTemplate -> Flag PathTemplate
forall a. a -> Flag a
toFlag (PathTemplate -> Flag PathTemplate)
-> (String -> PathTemplate) -> String -> Flag PathTemplate
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> PathTemplate
toPathTemplate)
(Flag String -> [String]
forall a. Flag a -> [a]
flagToList (Flag String -> [String])
-> (Flag PathTemplate -> Flag String)
-> Flag PathTemplate
-> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (PathTemplate -> String) -> Flag PathTemplate -> Flag String
forall a b. (a -> b) -> Flag a -> Flag b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap PathTemplate -> String
fromPathTemplate))
, String
-> [String]
-> String
-> (TestFlags -> Flag PathTemplate)
-> (Flag PathTemplate -> TestFlags -> TestFlags)
-> MkOptDescr
(TestFlags -> Flag PathTemplate)
(Flag PathTemplate -> TestFlags -> TestFlags)
TestFlags
-> OptionField TestFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option [] [String
"machine-log"]
(String
"Produce a machine-readable log file (name template can use "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"$pkgid, $compiler, $os, $arch, $result)")
TestFlags -> Flag PathTemplate
testMachineLog (\Flag PathTemplate
v TestFlags
flags -> TestFlags
flags { testMachineLog = v })
(String
-> (String -> Flag PathTemplate)
-> (Flag PathTemplate -> [String])
-> MkOptDescr
(TestFlags -> Flag PathTemplate)
(Flag PathTemplate -> TestFlags -> TestFlags)
TestFlags
forall b a.
Monoid b =>
String
-> (String -> b)
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg' String
"TEMPLATE"
(PathTemplate -> Flag PathTemplate
forall a. a -> Flag a
toFlag (PathTemplate -> Flag PathTemplate)
-> (String -> PathTemplate) -> String -> Flag PathTemplate
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> PathTemplate
toPathTemplate)
(Flag String -> [String]
forall a. Flag a -> [a]
flagToList (Flag String -> [String])
-> (Flag PathTemplate -> Flag String)
-> Flag PathTemplate
-> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (PathTemplate -> String) -> Flag PathTemplate -> Flag String
forall a b. (a -> b) -> Flag a -> Flag b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap PathTemplate -> String
fromPathTemplate))
, String
-> [String]
-> String
-> (TestFlags -> Flag TestShowDetails)
-> (Flag TestShowDetails -> TestFlags -> TestFlags)
-> MkOptDescr
(TestFlags -> Flag TestShowDetails)
(Flag TestShowDetails -> TestFlags -> TestFlags)
TestFlags
-> OptionField TestFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option [] [String
"show-details"]
(String
"'always': always show results of individual test cases. "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"'never': never show results of individual test cases. "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"'failures': show results of failing test cases. "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"'streaming': show results of test cases in real time."
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"'direct': send results of test cases in real time; no log file.")
TestFlags -> Flag TestShowDetails
testShowDetails (\Flag TestShowDetails
v TestFlags
flags -> TestFlags
flags { testShowDetails = v })
(String
-> ReadE (Flag TestShowDetails)
-> (Flag TestShowDetails -> [String])
-> MkOptDescr
(TestFlags -> Flag TestShowDetails)
(Flag TestShowDetails -> TestFlags -> TestFlags)
TestFlags
forall b a.
Monoid b =>
String
-> ReadE b
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg String
"FILTER"
((String -> String)
-> ParsecParser (Flag TestShowDetails)
-> ReadE (Flag TestShowDetails)
forall a. (String -> String) -> ParsecParser a -> ReadE a
parsecToReadE (\String
_ -> String
"--show-details flag expects one of "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String -> [String] -> String
forall a. [a] -> [[a]] -> [a]
intercalate String
", "
((TestShowDetails -> String) -> [TestShowDetails] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map TestShowDetails -> String
forall a. Pretty a => a -> String
prettyShow [TestShowDetails]
knownTestShowDetails))
((TestShowDetails -> Flag TestShowDetails)
-> ParsecParser TestShowDetails
-> ParsecParser (Flag TestShowDetails)
forall a b. (a -> b) -> ParsecParser a -> ParsecParser b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap TestShowDetails -> Flag TestShowDetails
forall a. a -> Flag a
toFlag ParsecParser TestShowDetails
forall a (m :: * -> *). (Parsec a, CabalParsing m) => m a
forall (m :: * -> *). CabalParsing m => m TestShowDetails
parsec))
(Flag String -> [String]
forall a. Flag a -> [a]
flagToList (Flag String -> [String])
-> (Flag TestShowDetails -> Flag String)
-> Flag TestShowDetails
-> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (TestShowDetails -> String) -> Flag TestShowDetails -> Flag String
forall a b. (a -> b) -> Flag a -> Flag b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap TestShowDetails -> String
forall a. Pretty a => a -> String
prettyShow))
, String
-> [String]
-> String
-> (TestFlags -> Flag Bool)
-> (Flag Bool -> TestFlags -> TestFlags)
-> MkOptDescr
(TestFlags -> Flag Bool)
(Flag Bool -> TestFlags -> TestFlags)
TestFlags
-> OptionField TestFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option [] [String
"keep-tix-files"]
String
"keep .tix files for HPC between test runs"
TestFlags -> Flag Bool
testKeepTix (\Flag Bool
v TestFlags
flags -> TestFlags
flags { testKeepTix = v})
MkOptDescr
(TestFlags -> Flag Bool)
(Flag Bool -> TestFlags -> TestFlags)
TestFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
, String
-> [String]
-> String
-> (TestFlags -> Flag String)
-> (Flag String -> TestFlags -> TestFlags)
-> MkOptDescr
(TestFlags -> Flag String)
(Flag String -> TestFlags -> TestFlags)
TestFlags
-> OptionField TestFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option [] [String
"test-wrapper"]
String
"Run test through a wrapper."
TestFlags -> Flag String
testWrapper (\Flag String
v TestFlags
flags -> TestFlags
flags { testWrapper = v })
(String
-> (String -> Flag String)
-> (Flag String -> [String])
-> MkOptDescr
(TestFlags -> Flag String)
(Flag String -> TestFlags -> TestFlags)
TestFlags
forall b a.
Monoid b =>
String
-> (String -> b)
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg' String
"FILE" (String -> Flag String
forall a. a -> Flag a
toFlag :: FilePath -> Flag FilePath)
(Flag String -> [String]
forall a. Flag a -> [a]
flagToList :: Flag FilePath -> [FilePath]))
, String
-> [String]
-> String
-> (TestFlags -> Flag Bool)
-> (Flag Bool -> TestFlags -> TestFlags)
-> MkOptDescr
(TestFlags -> Flag Bool)
(Flag Bool -> TestFlags -> TestFlags)
TestFlags
-> OptionField TestFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option [] [String
"fail-when-no-test-suites"]
(String
"Exit with failure when no test suites are found.")
TestFlags -> Flag Bool
testFailWhenNoTestSuites (\Flag Bool
v TestFlags
flags -> TestFlags
flags { testFailWhenNoTestSuites = v})
MkOptDescr
(TestFlags -> Flag Bool)
(Flag Bool -> TestFlags -> TestFlags)
TestFlags
forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg
, String
-> [String]
-> String
-> (TestFlags -> [PathTemplate])
-> ([PathTemplate] -> TestFlags -> TestFlags)
-> MkOptDescr
(TestFlags -> [PathTemplate])
([PathTemplate] -> TestFlags -> TestFlags)
TestFlags
-> OptionField TestFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option [] [String
"test-options"]
(String
"give extra options to test executables "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"(name templates can use $pkgid, $compiler, "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"$os, $arch, $test-suite)")
TestFlags -> [PathTemplate]
testOptions (\[PathTemplate]
v TestFlags
flags -> TestFlags
flags { testOptions = v })
(String
-> (String -> [PathTemplate])
-> ([PathTemplate] -> [String])
-> MkOptDescr
(TestFlags -> [PathTemplate])
([PathTemplate] -> TestFlags -> TestFlags)
TestFlags
forall b a.
Monoid b =>
String
-> (String -> b)
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg' String
"TEMPLATES" ((String -> PathTemplate) -> [String] -> [PathTemplate]
forall a b. (a -> b) -> [a] -> [b]
map String -> PathTemplate
toPathTemplate ([String] -> [PathTemplate])
-> (String -> [String]) -> String -> [PathTemplate]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> [String]
splitArgs)
([String] -> [PathTemplate] -> [String]
forall a b. a -> b -> a
const []))
, String
-> [String]
-> String
-> (TestFlags -> [PathTemplate])
-> ([PathTemplate] -> TestFlags -> TestFlags)
-> MkOptDescr
(TestFlags -> [PathTemplate])
([PathTemplate] -> TestFlags -> TestFlags)
TestFlags
-> OptionField TestFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option [] [String
"test-option"]
(String
"give extra option to test executables "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"(no need to quote options containing spaces, "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"name template can use $pkgid, $compiler, "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"$os, $arch, $test-suite)")
TestFlags -> [PathTemplate]
testOptions (\[PathTemplate]
v TestFlags
flags -> TestFlags
flags { testOptions = v })
(String
-> (String -> [PathTemplate])
-> ([PathTemplate] -> [String])
-> MkOptDescr
(TestFlags -> [PathTemplate])
([PathTemplate] -> TestFlags -> TestFlags)
TestFlags
forall b a.
Monoid b =>
String
-> (String -> b)
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg' String
"TEMPLATE" (\String
x -> [String -> PathTemplate
toPathTemplate String
x])
((PathTemplate -> String) -> [PathTemplate] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map PathTemplate -> String
fromPathTemplate))
]
emptyTestFlags :: TestFlags
emptyTestFlags :: TestFlags
emptyTestFlags = TestFlags
forall a. Monoid a => a
mempty
instance Monoid TestFlags where
mempty :: TestFlags
mempty = TestFlags
forall a. (Generic a, GMonoid (Rep a)) => a
gmempty
mappend :: TestFlags -> TestFlags -> TestFlags
mappend = TestFlags -> TestFlags -> TestFlags
forall a. Semigroup a => a -> a -> a
(<>)
instance Semigroup TestFlags where
<> :: TestFlags -> TestFlags -> TestFlags
(<>) = TestFlags -> TestFlags -> TestFlags
forall a. (Generic a, GSemigroup (Rep a)) => a -> a -> a
gmappend
data BenchmarkFlags = BenchmarkFlags {
BenchmarkFlags -> Flag String
benchmarkDistPref :: Flag FilePath,
BenchmarkFlags -> Flag Verbosity
benchmarkVerbosity :: Flag Verbosity,
BenchmarkFlags -> [PathTemplate]
benchmarkOptions :: [PathTemplate]
} deriving (Int -> BenchmarkFlags -> String -> String
[BenchmarkFlags] -> String -> String
BenchmarkFlags -> String
(Int -> BenchmarkFlags -> String -> String)
-> (BenchmarkFlags -> String)
-> ([BenchmarkFlags] -> String -> String)
-> Show BenchmarkFlags
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> BenchmarkFlags -> String -> String
showsPrec :: Int -> BenchmarkFlags -> String -> String
$cshow :: BenchmarkFlags -> String
show :: BenchmarkFlags -> String
$cshowList :: [BenchmarkFlags] -> String -> String
showList :: [BenchmarkFlags] -> String -> String
Show, (forall x. BenchmarkFlags -> Rep BenchmarkFlags x)
-> (forall x. Rep BenchmarkFlags x -> BenchmarkFlags)
-> Generic BenchmarkFlags
forall x. Rep BenchmarkFlags x -> BenchmarkFlags
forall x. BenchmarkFlags -> Rep BenchmarkFlags x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. BenchmarkFlags -> Rep BenchmarkFlags x
from :: forall x. BenchmarkFlags -> Rep BenchmarkFlags x
$cto :: forall x. Rep BenchmarkFlags x -> BenchmarkFlags
to :: forall x. Rep BenchmarkFlags x -> BenchmarkFlags
Generic, Typeable)
defaultBenchmarkFlags :: BenchmarkFlags
defaultBenchmarkFlags :: BenchmarkFlags
defaultBenchmarkFlags = BenchmarkFlags {
benchmarkDistPref :: Flag String
benchmarkDistPref = Flag String
forall a. Flag a
NoFlag,
benchmarkVerbosity :: Flag Verbosity
benchmarkVerbosity = Verbosity -> Flag Verbosity
forall a. a -> Flag a
Flag Verbosity
normal,
benchmarkOptions :: [PathTemplate]
benchmarkOptions = []
}
benchmarkCommand :: CommandUI BenchmarkFlags
benchmarkCommand :: CommandUI BenchmarkFlags
benchmarkCommand = CommandUI
{ commandName :: String
commandName = String
"bench"
, commandSynopsis :: String
commandSynopsis =
String
"Run all/specific benchmarks."
, commandDescription :: Maybe (String -> String)
commandDescription = (String -> String) -> Maybe (String -> String)
forall a. a -> Maybe a
Just ((String -> String) -> Maybe (String -> String))
-> (String -> String) -> Maybe (String -> String)
forall a b. (a -> b) -> a -> b
$ \ String
_pname -> String -> String
wrapText (String -> String) -> String -> String
forall a b. (a -> b) -> a -> b
$
String -> String
testOrBenchmarkHelpText String
"benchmark"
, commandNotes :: Maybe (String -> String)
commandNotes = Maybe (String -> String)
forall a. Maybe a
Nothing
, commandUsage :: String -> String
commandUsage = String -> [String] -> String -> String
usageAlternatives String
"bench"
[ String
"[FLAGS]"
, String
"BENCHCOMPONENTS [FLAGS]"
]
, commandDefaultFlags :: BenchmarkFlags
commandDefaultFlags = BenchmarkFlags
defaultBenchmarkFlags
, commandOptions :: ShowOrParseArgs -> [OptionField BenchmarkFlags]
commandOptions = ShowOrParseArgs -> [OptionField BenchmarkFlags]
benchmarkOptions'
}
benchmarkOptions' :: ShowOrParseArgs -> [OptionField BenchmarkFlags]
benchmarkOptions' :: ShowOrParseArgs -> [OptionField BenchmarkFlags]
benchmarkOptions' ShowOrParseArgs
showOrParseArgs =
[ (BenchmarkFlags -> Flag Verbosity)
-> (Flag Verbosity -> BenchmarkFlags -> BenchmarkFlags)
-> OptionField BenchmarkFlags
forall flags.
(flags -> Flag Verbosity)
-> (Flag Verbosity -> flags -> flags) -> OptionField flags
optionVerbosity BenchmarkFlags -> Flag Verbosity
benchmarkVerbosity
(\Flag Verbosity
v BenchmarkFlags
flags -> BenchmarkFlags
flags { benchmarkVerbosity = v })
, (BenchmarkFlags -> Flag String)
-> (Flag String -> BenchmarkFlags -> BenchmarkFlags)
-> ShowOrParseArgs
-> OptionField BenchmarkFlags
forall flags.
(flags -> Flag String)
-> (Flag String -> flags -> flags)
-> ShowOrParseArgs
-> OptionField flags
optionDistPref
BenchmarkFlags -> Flag String
benchmarkDistPref (\Flag String
d BenchmarkFlags
flags -> BenchmarkFlags
flags { benchmarkDistPref = d })
ShowOrParseArgs
showOrParseArgs
, String
-> [String]
-> String
-> (BenchmarkFlags -> [PathTemplate])
-> ([PathTemplate] -> BenchmarkFlags -> BenchmarkFlags)
-> MkOptDescr
(BenchmarkFlags -> [PathTemplate])
([PathTemplate] -> BenchmarkFlags -> BenchmarkFlags)
BenchmarkFlags
-> OptionField BenchmarkFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option [] [String
"benchmark-options"]
(String
"give extra options to benchmark executables "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"(name templates can use $pkgid, $compiler, "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"$os, $arch, $benchmark)")
BenchmarkFlags -> [PathTemplate]
benchmarkOptions (\[PathTemplate]
v BenchmarkFlags
flags -> BenchmarkFlags
flags { benchmarkOptions = v })
(String
-> (String -> [PathTemplate])
-> ([PathTemplate] -> [String])
-> MkOptDescr
(BenchmarkFlags -> [PathTemplate])
([PathTemplate] -> BenchmarkFlags -> BenchmarkFlags)
BenchmarkFlags
forall b a.
Monoid b =>
String
-> (String -> b)
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg' String
"TEMPLATES" ((String -> PathTemplate) -> [String] -> [PathTemplate]
forall a b. (a -> b) -> [a] -> [b]
map String -> PathTemplate
toPathTemplate ([String] -> [PathTemplate])
-> (String -> [String]) -> String -> [PathTemplate]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> [String]
splitArgs)
([String] -> [PathTemplate] -> [String]
forall a b. a -> b -> a
const []))
, String
-> [String]
-> String
-> (BenchmarkFlags -> [PathTemplate])
-> ([PathTemplate] -> BenchmarkFlags -> BenchmarkFlags)
-> MkOptDescr
(BenchmarkFlags -> [PathTemplate])
([PathTemplate] -> BenchmarkFlags -> BenchmarkFlags)
BenchmarkFlags
-> OptionField BenchmarkFlags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option [] [String
"benchmark-option"]
(String
"give extra option to benchmark executables "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"(no need to quote options containing spaces, "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"name template can use $pkgid, $compiler, "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"$os, $arch, $benchmark)")
BenchmarkFlags -> [PathTemplate]
benchmarkOptions (\[PathTemplate]
v BenchmarkFlags
flags -> BenchmarkFlags
flags { benchmarkOptions = v })
(String
-> (String -> [PathTemplate])
-> ([PathTemplate] -> [String])
-> MkOptDescr
(BenchmarkFlags -> [PathTemplate])
([PathTemplate] -> BenchmarkFlags -> BenchmarkFlags)
BenchmarkFlags
forall b a.
Monoid b =>
String
-> (String -> b)
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg' String
"TEMPLATE" (\String
x -> [String -> PathTemplate
toPathTemplate String
x])
((PathTemplate -> String) -> [PathTemplate] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map PathTemplate -> String
fromPathTemplate))
]
emptyBenchmarkFlags :: BenchmarkFlags
emptyBenchmarkFlags :: BenchmarkFlags
emptyBenchmarkFlags = BenchmarkFlags
forall a. Monoid a => a
mempty
instance Monoid BenchmarkFlags where
mempty :: BenchmarkFlags
mempty = BenchmarkFlags
forall a. (Generic a, GMonoid (Rep a)) => a
gmempty
mappend :: BenchmarkFlags -> BenchmarkFlags -> BenchmarkFlags
mappend = BenchmarkFlags -> BenchmarkFlags -> BenchmarkFlags
forall a. Semigroup a => a -> a -> a
(<>)
instance Semigroup BenchmarkFlags where
<> :: BenchmarkFlags -> BenchmarkFlags -> BenchmarkFlags
(<>) = BenchmarkFlags -> BenchmarkFlags -> BenchmarkFlags
forall a. (Generic a, GSemigroup (Rep a)) => a -> a -> a
gmappend
programFlagsDescription :: ProgramDb -> String
programFlagsDescription :: ProgramDb -> String
programFlagsDescription ProgramDb
progDb =
String
"The flags --with-PROG and --PROG-option(s) can be used with"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" the following programs:"
String -> String -> String
forall a. [a] -> [a] -> [a]
++ (([String] -> String) -> [[String]] -> String
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\[String]
line -> String
"\n " String -> String -> String
forall a. [a] -> [a] -> [a]
++ [String] -> String
unwords [String]
line) ([[String]] -> String)
-> ([String] -> [[String]]) -> [String] -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> [String] -> [[String]]
wrapLine Int
77 ([String] -> [[String]])
-> ([String] -> [String]) -> [String] -> [[String]]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [String] -> [String]
forall a. Ord a => [a] -> [a]
sort)
[ Program -> String
programName Program
prog | (Program
prog, Maybe ConfiguredProgram
_) <- ProgramDb -> [(Program, Maybe ConfiguredProgram)]
knownPrograms ProgramDb
progDb ]
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"\n"
programDbPaths
:: ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, FilePath)])
-> ([(String, FilePath)] -> (flags -> flags))
-> [OptionField flags]
programDbPaths :: forall flags.
ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, String)])
-> ([(String, String)] -> flags -> flags)
-> [OptionField flags]
programDbPaths ProgramDb
progDb ShowOrParseArgs
showOrParseArgs flags -> [(String, String)]
get [(String, String)] -> flags -> flags
set =
(String -> String)
-> ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, String)])
-> ([(String, String)] -> flags -> flags)
-> [OptionField flags]
forall flags.
(String -> String)
-> ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, String)])
-> ([(String, String)] -> flags -> flags)
-> [OptionField flags]
programDbPaths' (String
"with-" String -> String -> String
forall a. [a] -> [a] -> [a]
++) ProgramDb
progDb ShowOrParseArgs
showOrParseArgs flags -> [(String, String)]
get [(String, String)] -> flags -> flags
set
programDbPaths'
:: (String -> String)
-> ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, FilePath)])
-> ([(String, FilePath)] -> (flags -> flags))
-> [OptionField flags]
programDbPaths' :: forall flags.
(String -> String)
-> ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, String)])
-> ([(String, String)] -> flags -> flags)
-> [OptionField flags]
programDbPaths' String -> String
mkName ProgramDb
progDb ShowOrParseArgs
showOrParseArgs flags -> [(String, String)]
get [(String, String)] -> flags -> flags
set =
case ShowOrParseArgs
showOrParseArgs of
ShowOrParseArgs
ShowArgs -> [String -> OptionField flags
withProgramPath String
"PROG"]
ShowOrParseArgs
ParseArgs -> ((Program, Maybe ConfiguredProgram) -> OptionField flags)
-> [(Program, Maybe ConfiguredProgram)] -> [OptionField flags]
forall a b. (a -> b) -> [a] -> [b]
map (String -> OptionField flags
withProgramPath (String -> OptionField flags)
-> ((Program, Maybe ConfiguredProgram) -> String)
-> (Program, Maybe ConfiguredProgram)
-> OptionField flags
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Program -> String
programName (Program -> String)
-> ((Program, Maybe ConfiguredProgram) -> Program)
-> (Program, Maybe ConfiguredProgram)
-> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Program, Maybe ConfiguredProgram) -> Program
forall a b. (a, b) -> a
fst)
(ProgramDb -> [(Program, Maybe ConfiguredProgram)]
knownPrograms ProgramDb
progDb)
where
withProgramPath :: String -> OptionField flags
withProgramPath String
prog =
String
-> [String]
-> String
-> (flags -> [(String, String)])
-> ([(String, String)] -> flags -> flags)
-> MkOptDescr
(flags -> [(String, String)])
([(String, String)] -> flags -> flags)
flags
-> OptionField flags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String -> String
mkName String
prog]
(String
"give the path to " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
prog)
flags -> [(String, String)]
get [(String, String)] -> flags -> flags
set
(String
-> (String -> [(String, String)])
-> ([(String, String)] -> [String])
-> MkOptDescr
(flags -> [(String, String)])
([(String, String)] -> flags -> flags)
flags
forall b a.
Monoid b =>
String
-> (String -> b)
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg' String
"PATH" (\String
path -> [(String
prog, String
path)])
(\[(String, String)]
progPaths -> [ String
path | (String
prog', String
path) <- [(String, String)]
progPaths, String
progString -> String -> Bool
forall a. Eq a => a -> a -> Bool
==String
prog' ]))
programDbOption
:: ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, [String])])
-> ([(String, [String])] -> (flags -> flags))
-> [OptionField flags]
programDbOption :: forall flags.
ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, [String])])
-> ([(String, [String])] -> flags -> flags)
-> [OptionField flags]
programDbOption ProgramDb
progDb ShowOrParseArgs
showOrParseArgs flags -> [(String, [String])]
get [(String, [String])] -> flags -> flags
set =
case ShowOrParseArgs
showOrParseArgs of
ShowOrParseArgs
ShowArgs -> [String -> OptionField flags
programOption String
"PROG"]
ShowOrParseArgs
ParseArgs -> ((Program, Maybe ConfiguredProgram) -> OptionField flags)
-> [(Program, Maybe ConfiguredProgram)] -> [OptionField flags]
forall a b. (a -> b) -> [a] -> [b]
map (String -> OptionField flags
programOption (String -> OptionField flags)
-> ((Program, Maybe ConfiguredProgram) -> String)
-> (Program, Maybe ConfiguredProgram)
-> OptionField flags
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Program -> String
programName (Program -> String)
-> ((Program, Maybe ConfiguredProgram) -> Program)
-> (Program, Maybe ConfiguredProgram)
-> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Program, Maybe ConfiguredProgram) -> Program
forall a b. (a, b) -> a
fst)
(ProgramDb -> [(Program, Maybe ConfiguredProgram)]
knownPrograms ProgramDb
progDb)
where
programOption :: String -> OptionField flags
programOption String
prog =
String
-> [String]
-> String
-> (flags -> [(String, [String])])
-> ([(String, [String])] -> flags -> flags)
-> MkOptDescr
(flags -> [(String, [String])])
([(String, [String])] -> flags -> flags)
flags
-> OptionField flags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
prog String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"-option"]
(String
"give an extra option to " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
prog String -> String -> String
forall a. [a] -> [a] -> [a]
++
String
" (no need to quote options containing spaces)")
flags -> [(String, [String])]
get [(String, [String])] -> flags -> flags
set
(String
-> (String -> [(String, [String])])
-> ([(String, [String])] -> [String])
-> MkOptDescr
(flags -> [(String, [String])])
([(String, [String])] -> flags -> flags)
flags
forall b a.
Monoid b =>
String
-> (String -> b)
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg' String
"OPT" (\String
arg -> [(String
prog, [String
arg])])
(\[(String, [String])]
progArgs -> [[String]] -> [String]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat [ [String]
args
| (String
prog', [String]
args) <- [(String, [String])]
progArgs, String
progString -> String -> Bool
forall a. Eq a => a -> a -> Bool
==String
prog' ]))
programDbOptions
:: ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, [String])])
-> ([(String, [String])] -> (flags -> flags))
-> [OptionField flags]
programDbOptions :: forall flags.
ProgramDb
-> ShowOrParseArgs
-> (flags -> [(String, [String])])
-> ([(String, [String])] -> flags -> flags)
-> [OptionField flags]
programDbOptions ProgramDb
progDb ShowOrParseArgs
showOrParseArgs flags -> [(String, [String])]
get [(String, [String])] -> flags -> flags
set =
case ShowOrParseArgs
showOrParseArgs of
ShowOrParseArgs
ShowArgs -> [String -> OptionField flags
programOptions String
"PROG"]
ShowOrParseArgs
ParseArgs -> ((Program, Maybe ConfiguredProgram) -> OptionField flags)
-> [(Program, Maybe ConfiguredProgram)] -> [OptionField flags]
forall a b. (a -> b) -> [a] -> [b]
map (String -> OptionField flags
programOptions (String -> OptionField flags)
-> ((Program, Maybe ConfiguredProgram) -> String)
-> (Program, Maybe ConfiguredProgram)
-> OptionField flags
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Program -> String
programName (Program -> String)
-> ((Program, Maybe ConfiguredProgram) -> Program)
-> (Program, Maybe ConfiguredProgram)
-> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Program, Maybe ConfiguredProgram) -> Program
forall a b. (a, b) -> a
fst)
(ProgramDb -> [(Program, Maybe ConfiguredProgram)]
knownPrograms ProgramDb
progDb)
where
programOptions :: String -> OptionField flags
programOptions String
prog =
String
-> [String]
-> String
-> (flags -> [(String, [String])])
-> ([(String, [String])] -> flags -> flags)
-> MkOptDescr
(flags -> [(String, [String])])
([(String, [String])] -> flags -> flags)
flags
-> OptionField flags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" [String
prog String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"-options"]
(String
"give extra options to " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
prog)
flags -> [(String, [String])]
get [(String, [String])] -> flags -> flags
set
(String
-> (String -> [(String, [String])])
-> ([(String, [String])] -> [String])
-> MkOptDescr
(flags -> [(String, [String])])
([(String, [String])] -> flags -> flags)
flags
forall b a.
Monoid b =>
String
-> (String -> b)
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg' String
"OPTS" (\String
args -> [(String
prog, String -> [String]
splitArgs String
args)]) ([String] -> [(String, [String])] -> [String]
forall a b. a -> b -> a
const []))
boolOpt :: SFlags -> SFlags
-> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
boolOpt :: forall a.
String
-> String -> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
boolOpt = (Flag Bool -> Maybe Bool)
-> (Bool -> Flag Bool)
-> String
-> String
-> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
forall b a.
(b -> Maybe Bool)
-> (Bool -> b)
-> String
-> String
-> MkOptDescr (a -> b) (b -> a -> a) a
Command.boolOpt Flag Bool -> Maybe Bool
forall a. Flag a -> Maybe a
flagToMaybe Bool -> Flag Bool
forall a. a -> Flag a
Flag
boolOpt' :: OptFlags -> OptFlags
-> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
boolOpt' :: forall a.
(String, [String])
-> (String, [String])
-> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
boolOpt' = (Flag Bool -> Maybe Bool)
-> (Bool -> Flag Bool)
-> (String, [String])
-> (String, [String])
-> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
forall b a.
(b -> Maybe Bool)
-> (Bool -> b)
-> (String, [String])
-> (String, [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
Command.boolOpt' Flag Bool -> Maybe Bool
forall a. Flag a -> Maybe a
flagToMaybe Bool -> Flag Bool
forall a. a -> Flag a
Flag
trueArg, falseArg :: MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg :: forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
trueArg String
sfT [String]
lfT = (String, [String])
-> (String, [String])
-> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
forall a.
(String, [String])
-> (String, [String])
-> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
boolOpt' (String
sfT, [String]
lfT) ([], []) String
sfT [String]
lfT
falseArg :: forall a. MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
falseArg String
sfF [String]
lfF = (String, [String])
-> (String, [String])
-> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
forall a.
(String, [String])
-> (String, [String])
-> MkOptDescr (a -> Flag Bool) (Flag Bool -> a -> a) a
boolOpt' ([], []) (String
sfF, [String]
lfF) String
sfF [String]
lfF
reqArgFlag :: ArgPlaceHolder -> SFlags -> LFlags -> Description ->
(b -> Flag String) -> (Flag String -> b -> b) -> OptDescr b
reqArgFlag :: forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
ad = String
-> ReadE (Flag String)
-> (Flag String -> [String])
-> MkOptDescr (b -> Flag String) (Flag String -> b -> b) b
forall b a.
Monoid b =>
String
-> ReadE b
-> (b -> [String])
-> MkOptDescr (a -> b) (b -> a -> a) a
reqArg String
ad ((String -> Flag String) -> ReadE (Flag String)
forall a. (String -> a) -> ReadE a
succeedReadE String -> Flag String
forall a. a -> Flag a
Flag) Flag String -> [String]
forall a. Flag a -> [a]
flagToList
optionDistPref :: (flags -> Flag FilePath)
-> (Flag FilePath -> flags -> flags)
-> ShowOrParseArgs
-> OptionField flags
optionDistPref :: forall flags.
(flags -> Flag String)
-> (Flag String -> flags -> flags)
-> ShowOrParseArgs
-> OptionField flags
optionDistPref flags -> Flag String
get Flag String -> flags -> flags
set = \ShowOrParseArgs
showOrParseArgs ->
String
-> [String]
-> String
-> (flags -> Flag String)
-> (Flag String -> flags -> flags)
-> MkOptDescr
(flags -> Flag String) (Flag String -> flags -> flags) flags
-> OptionField flags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"" (ShowOrParseArgs -> [String]
distPrefFlagName ShowOrParseArgs
showOrParseArgs)
( String
"The directory where Cabal puts generated build files "
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"(default " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
defaultDistPref String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")")
flags -> Flag String
get Flag String -> flags -> flags
set
(String
-> MkOptDescr
(flags -> Flag String) (Flag String -> flags -> flags) flags
forall b.
String
-> String
-> [String]
-> String
-> (b -> Flag String)
-> (Flag String -> b -> b)
-> OptDescr b
reqArgFlag String
"DIR")
where
distPrefFlagName :: ShowOrParseArgs -> [String]
distPrefFlagName ShowOrParseArgs
ShowArgs = [String
"builddir"]
distPrefFlagName ShowOrParseArgs
ParseArgs = [String
"builddir", String
"distdir", String
"distpref"]
optionVerbosity :: (flags -> Flag Verbosity)
-> (Flag Verbosity -> flags -> flags)
-> OptionField flags
optionVerbosity :: forall flags.
(flags -> Flag Verbosity)
-> (Flag Verbosity -> flags -> flags) -> OptionField flags
optionVerbosity flags -> Flag Verbosity
get Flag Verbosity -> flags -> flags
set =
String
-> [String]
-> String
-> (flags -> Flag Verbosity)
-> (Flag Verbosity -> flags -> flags)
-> MkOptDescr
(flags -> Flag Verbosity) (Flag Verbosity -> flags -> flags) flags
-> OptionField flags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"v" [String
"verbose"]
String
"Control verbosity (n is 0--3, default verbosity level is 1)"
flags -> Flag Verbosity
get Flag Verbosity -> flags -> flags
set
(String
-> ReadE (Flag Verbosity)
-> Flag Verbosity
-> (Flag Verbosity -> [Maybe String])
-> MkOptDescr
(flags -> Flag Verbosity) (Flag Verbosity -> flags -> flags) flags
forall b a.
Monoid b =>
String
-> ReadE b
-> b
-> (b -> [Maybe String])
-> MkOptDescr (a -> b) (b -> a -> a) a
optArg String
"n" ((Verbosity -> Flag Verbosity)
-> ReadE Verbosity -> ReadE (Flag Verbosity)
forall a b. (a -> b) -> ReadE a -> ReadE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Verbosity -> Flag Verbosity
forall a. a -> Flag a
Flag ReadE Verbosity
flagToVerbosity)
(Verbosity -> Flag Verbosity
forall a. a -> Flag a
Flag Verbosity
verbose)
((Verbosity -> Maybe String) -> [Verbosity] -> [Maybe String]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (String -> Maybe String
forall a. a -> Maybe a
Just (String -> Maybe String)
-> (Verbosity -> String) -> Verbosity -> Maybe String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Verbosity -> String
showForCabal) ([Verbosity] -> [Maybe String])
-> (Flag Verbosity -> [Verbosity])
-> Flag Verbosity
-> [Maybe String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Flag Verbosity -> [Verbosity]
forall a. Flag a -> [a]
flagToList))
optionNumJobs :: (flags -> Flag (Maybe Int))
-> (Flag (Maybe Int) -> flags -> flags)
-> OptionField flags
optionNumJobs :: forall flags.
(flags -> Flag (Maybe Int))
-> (Flag (Maybe Int) -> flags -> flags) -> OptionField flags
optionNumJobs flags -> Flag (Maybe Int)
get Flag (Maybe Int) -> flags -> flags
set =
String
-> [String]
-> String
-> (flags -> Flag (Maybe Int))
-> (Flag (Maybe Int) -> flags -> flags)
-> MkOptDescr
(flags -> Flag (Maybe Int))
(Flag (Maybe Int) -> flags -> flags)
flags
-> OptionField flags
forall get set a.
String
-> [String]
-> String
-> get
-> set
-> MkOptDescr get set a
-> OptionField a
option String
"j" [String
"jobs"]
String
"Run NUM jobs simultaneously (or '$ncpus' if no NUM is given)."
flags -> Flag (Maybe Int)
get Flag (Maybe Int) -> flags -> flags
set
(String
-> ReadE (Flag (Maybe Int))
-> Flag (Maybe Int)
-> (Flag (Maybe Int) -> [Maybe String])
-> MkOptDescr
(flags -> Flag (Maybe Int))
(Flag (Maybe Int) -> flags -> flags)
flags
forall b a.
Monoid b =>
String
-> ReadE b
-> b
-> (b -> [Maybe String])
-> MkOptDescr (a -> b) (b -> a -> a) a
optArg String
"NUM" ((Maybe Int -> Flag (Maybe Int))
-> ReadE (Maybe Int) -> ReadE (Flag (Maybe Int))
forall a b. (a -> b) -> ReadE a -> ReadE b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Maybe Int -> Flag (Maybe Int)
forall a. a -> Flag a
Flag ReadE (Maybe Int)
numJobsParser)
(Maybe Int -> Flag (Maybe Int)
forall a. a -> Flag a
Flag Maybe Int
forall a. Maybe a
Nothing)
((Maybe Int -> Maybe String) -> [Maybe Int] -> [Maybe String]
forall a b. (a -> b) -> [a] -> [b]
map (String -> Maybe String
forall a. a -> Maybe a
Just (String -> Maybe String)
-> (Maybe Int -> String) -> Maybe Int -> Maybe String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> (Int -> String) -> Maybe Int -> String
forall b a. b -> (a -> b) -> Maybe a -> b
maybe String
"$ncpus" Int -> String
forall a. Show a => a -> String
show) ([Maybe Int] -> [Maybe String])
-> (Flag (Maybe Int) -> [Maybe Int])
-> Flag (Maybe Int)
-> [Maybe String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Flag (Maybe Int) -> [Maybe Int]
forall a. Flag a -> [a]
flagToList))
where
numJobsParser :: ReadE (Maybe Int)
numJobsParser :: ReadE (Maybe Int)
numJobsParser = (String -> Either String (Maybe Int)) -> ReadE (Maybe Int)
forall a. (String -> Either String a) -> ReadE a
ReadE ((String -> Either String (Maybe Int)) -> ReadE (Maybe Int))
-> (String -> Either String (Maybe Int)) -> ReadE (Maybe Int)
forall a b. (a -> b) -> a -> b
$ \String
s ->
case String
s of
String
"$ncpus" -> Maybe Int -> Either String (Maybe Int)
forall a b. b -> Either a b
Right Maybe Int
forall a. Maybe a
Nothing
String
_ -> case ReadS Int
forall a. Read a => ReadS a
reads String
s of
[(Int
n, String
"")]
| Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< Int
1 -> String -> Either String (Maybe Int)
forall a b. a -> Either a b
Left String
"The number of jobs should be 1 or more."
| Bool
otherwise -> Maybe Int -> Either String (Maybe Int)
forall a b. b -> Either a b
Right (Int -> Maybe Int
forall a. a -> Maybe a
Just Int
n)
[(Int, String)]
_ -> String -> Either String (Maybe Int)
forall a b. a -> Either a b
Left String
"The jobs value should be a number or '$ncpus'"
configureArgs :: Bool -> ConfigFlags -> [String]
configureArgs :: Bool -> ConfigFlags -> [String]
configureArgs Bool
bcHack ConfigFlags
flags
= [String]
hc_flag
[String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ String -> (ConfigFlags -> Flag String) -> [String]
optFlag String
"with-hc-pkg" ConfigFlags -> Flag String
configHcPkg
[String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ String
-> (InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
-> [String]
optFlag' String
"prefix" InstallDirs (Flag PathTemplate) -> Flag PathTemplate
forall dir. InstallDirs dir -> dir
prefix
[String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ String
-> (InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
-> [String]
optFlag' String
"bindir" InstallDirs (Flag PathTemplate) -> Flag PathTemplate
forall dir. InstallDirs dir -> dir
bindir
[String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ String
-> (InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
-> [String]
optFlag' String
"libdir" InstallDirs (Flag PathTemplate) -> Flag PathTemplate
forall dir. InstallDirs dir -> dir
libdir
[String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ String
-> (InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
-> [String]
optFlag' String
"libexecdir" InstallDirs (Flag PathTemplate) -> Flag PathTemplate
forall dir. InstallDirs dir -> dir
libexecdir
[String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ String
-> (InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
-> [String]
optFlag' String
"datadir" InstallDirs (Flag PathTemplate) -> Flag PathTemplate
forall dir. InstallDirs dir -> dir
datadir
[String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ String
-> (InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
-> [String]
optFlag' String
"sysconfdir" InstallDirs (Flag PathTemplate) -> Flag PathTemplate
forall dir. InstallDirs dir -> dir
sysconfdir
[String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ ConfigFlags -> [String]
configConfigureArgs ConfigFlags
flags
where
hc_flag :: [String]
hc_flag = case (ConfigFlags -> Flag CompilerFlavor
configHcFlavor ConfigFlags
flags, ConfigFlags -> Flag String
configHcPath ConfigFlags
flags) of
(Flag CompilerFlavor
_, Flag String
hc_path) -> [String
hc_flag_name String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
hc_path]
(Flag CompilerFlavor
hc, Flag String
NoFlag) -> [String
hc_flag_name String -> String -> String
forall a. [a] -> [a] -> [a]
++ CompilerFlavor -> String
forall a. Pretty a => a -> String
prettyShow CompilerFlavor
hc]
(Flag CompilerFlavor
NoFlag,Flag String
NoFlag) -> []
hc_flag_name :: String
hc_flag_name
| Bool
bcHack = String
"--with-hc="
| Bool
otherwise = String
"--with-compiler="
optFlag :: String -> (ConfigFlags -> Flag String) -> [String]
optFlag String
name ConfigFlags -> Flag String
config_field = case ConfigFlags -> Flag String
config_field ConfigFlags
flags of
Flag String
p -> [String
"--" String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
name String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"=" String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
p]
Flag String
NoFlag -> []
optFlag' :: String
-> (InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
-> [String]
optFlag' String
name InstallDirs (Flag PathTemplate) -> Flag PathTemplate
config_field = String -> (ConfigFlags -> Flag String) -> [String]
optFlag String
name ((PathTemplate -> String) -> Flag PathTemplate -> Flag String
forall a b. (a -> b) -> Flag a -> Flag b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap PathTemplate -> String
fromPathTemplate
(Flag PathTemplate -> Flag String)
-> (ConfigFlags -> Flag PathTemplate) -> ConfigFlags -> Flag String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. InstallDirs (Flag PathTemplate) -> Flag PathTemplate
config_field
(InstallDirs (Flag PathTemplate) -> Flag PathTemplate)
-> (ConfigFlags -> InstallDirs (Flag PathTemplate))
-> ConfigFlags
-> Flag PathTemplate
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ConfigFlags -> InstallDirs (Flag PathTemplate)
configInstallDirs)
configureCCompiler :: Verbosity -> ProgramDb
-> IO (FilePath, [String])
configureCCompiler :: Verbosity -> ProgramDb -> IO (String, [String])
configureCCompiler Verbosity
verbosity ProgramDb
progdb = Verbosity -> ProgramDb -> Program -> IO (String, [String])
configureProg Verbosity
verbosity ProgramDb
progdb Program
gccProgram
configureLinker :: Verbosity -> ProgramDb -> IO (FilePath, [String])
configureLinker :: Verbosity -> ProgramDb -> IO (String, [String])
configureLinker Verbosity
verbosity ProgramDb
progdb = Verbosity -> ProgramDb -> Program -> IO (String, [String])
configureProg Verbosity
verbosity ProgramDb
progdb Program
ldProgram
configureProg :: Verbosity -> ProgramDb -> Program
-> IO (FilePath, [String])
configureProg :: Verbosity -> ProgramDb -> Program -> IO (String, [String])
configureProg Verbosity
verbosity ProgramDb
programDb Program
prog = do
(ConfiguredProgram
p, ProgramDb
_) <- Verbosity
-> Program -> ProgramDb -> IO (ConfiguredProgram, ProgramDb)
requireProgram Verbosity
verbosity Program
prog ProgramDb
programDb
let pInv :: ProgramInvocation
pInv = ConfiguredProgram -> [String] -> ProgramInvocation
programInvocation ConfiguredProgram
p []
(String, [String]) -> IO (String, [String])
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (ProgramInvocation -> String
progInvokePath ProgramInvocation
pInv, ProgramInvocation -> [String]
progInvokeArgs ProgramInvocation
pInv)
splitArgs :: String -> [String]
splitArgs :: String -> [String]
splitArgs = String -> String -> [String]
space []
where
space :: String -> String -> [String]
space :: String -> String -> [String]
space String
w [] = String -> [String] -> [String]
forall {a}. [a] -> [[a]] -> [[a]]
word String
w []
space String
w ( Char
c :String
s)
| Char -> Bool
isSpace Char
c = String -> [String] -> [String]
forall {a}. [a] -> [[a]] -> [[a]]
word String
w (String -> String -> [String]
space [] String
s)
space String
w (Char
'"':String
s) = String -> String -> [String]
string String
w String
s
space String
w String
s = String -> String -> [String]
nonstring String
w String
s
string :: String -> String -> [String]
string :: String -> String -> [String]
string String
w [] = String -> [String] -> [String]
forall {a}. [a] -> [[a]] -> [[a]]
word String
w []
string String
w (Char
'"':String
s) = String -> String -> [String]
space String
w String
s
string String
w (Char
'\\':Char
'"':String
s) = String -> String -> [String]
string (Char
'"'Char -> String -> String
forall a. a -> [a] -> [a]
:String
w) String
s
string String
w ( Char
c :String
s) = String -> String -> [String]
string (Char
cChar -> String -> String
forall a. a -> [a] -> [a]
:String
w) String
s
nonstring :: String -> String -> [String]
nonstring :: String -> String -> [String]
nonstring String
w [] = String -> [String] -> [String]
forall {a}. [a] -> [[a]] -> [[a]]
word String
w []
nonstring String
w (Char
'"':String
s) = String -> String -> [String]
string String
w String
s
nonstring String
w ( Char
c :String
s) = String -> String -> [String]
space (Char
cChar -> String -> String
forall a. a -> [a] -> [a]
:String
w) String
s
word :: [a] -> [[a]] -> [[a]]
word [] [[a]]
s = [[a]]
s
word [a]
w [[a]]
s = [a] -> [a]
forall a. [a] -> [a]
reverse [a]
w [a] -> [[a]] -> [[a]]
forall a. a -> [a] -> [a]
: [[a]]
s