Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Options.Harg.Types
Contents
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
- _optDefault :: 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
Constructors
Opt | |
Fields
|
Option types
Constructors
OptionOptType | |
FlagOptType a |
|
ArgumentOptType |
Constructors
OptDefault | |
OptOptional |
Intermediate option types
data OptionOpt (attr :: [OptAttr]) a Source #
Option for flags with arguments. Corresponds to option
.
Constructors
OptionOpt | |
Instances
data FlagOpt (attr :: [OptAttr]) a Source #
Option for flags that act like switches between a default and an active
value. Corresponds to flag
.
Constructors
FlagOpt | |
data ArgumentOpt (attr :: [OptAttr]) a Source #
Option for arguments (no long/short specifiers). Corresponds to
argument
.
Constructors
ArgumentOpt | |
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.
Constructors
HargCtx | |
Fields
|
ctxFromEnv :: Environment -> IO HargCtx Source #