Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- type OptReader a = String -> Either String a
- data Opt a = Opt {
- _optLong :: Maybe String
- _optShort :: Maybe Char
- _optHelp :: Maybe String
- _optMetavar :: Maybe String
- _optEnvVar :: Maybe String
- _optDefaultVal :: Maybe a
- _optDefaultStr :: Maybe String
- _optReader :: OptReader a
- _optType :: OptType a
- data OptType a
- data OptAttr
- data OptionOpt (attr :: [OptAttr]) a = OptionOpt {}
- data FlagOpt (attr :: [OptAttr]) a = FlagOpt {}
- data ArgumentOpt (attr :: [OptAttr]) a = ArgumentOpt {}
- data OptError = OptError {}
- data SomeOpt where
- type Environment = [(String, String)]
- type Args = [String]
- data HargCtx = HargCtx {
- _hcEnv :: Environment
- _hcArgs :: Args
- getCtx :: IO HargCtx
- ctxFromArgs :: Args -> IO HargCtx
- ctxFromEnv :: Environment -> IO HargCtx
- pureCtx :: Environment -> Args -> HargCtx
- toOptError :: Opt a -> Maybe String -> String -> OptError
Documentation
The basic option type
Opt | |
|
Option types
OptionOptType | |
FlagOptType a |
|
ArgumentOptType |
Intermediate option types
data OptionOpt (attr :: [OptAttr]) a Source #
Option for flags with arguments. Corresponds to option
.
Instances
data FlagOpt (attr :: [OptAttr]) a Source #
Option for flags that act like switches between a default and an active
value. Corresponds to flag
.
data ArgumentOpt (attr :: [OptAttr]) a Source #
Option for arguments (no long/short specifiers). Corresponds to
argument
.
Instances
Datatype that holds errors that arise when running the sources.
The reason why this is the only place where errors occur is that,
if something goes wrong when running the parser, it will be handled
by optparse-applicative
.
Existential wrapper for Opt
, so that many options can be carried in
a list.
type Environment = [(String, String)] Source #
Environment variable pairs, can be retrieved with getEnvironment
.
Context to carry around, that contains environment variables and command line arguments.
HargCtx | |
|
ctxFromEnv :: Environment -> IO HargCtx Source #