harg-0.4.0.0: Haskell program configuration using higher kinded data

Safe HaskellSafe
LanguageHaskell2010

Options.Harg.Types

Contents

Synopsis

Documentation

data Opt a Source #

The basic option type

Constructors

Opt 

Fields

Instances
Functor Opt Source # 
Instance details

Defined in Options.Harg.Types

Methods

fmap :: (a -> b) -> Opt a -> Opt b #

(<$) :: a -> Opt b -> Opt a #

data OptType a Source #

Option types

Constructors

OptionOptType 
FlagOptType a

a is the active value for the flag parser

ArgumentOptType 
Instances
Functor OptType Source # 
Instance details

Defined in Options.Harg.Types

Methods

fmap :: (a -> b) -> OptType a -> OptType b #

(<$) :: a -> OptType b -> OptType a #

Intermediate option types

data OptionOpt (attr :: [OptAttr]) a Source #

Option for flags with arguments. Corresponds to option.

Instances
IsOpt OptionOpt attr Source # 
Instance details

Defined in Options.Harg.Construct

Methods

toOpt :: OptionOpt attr a -> Opt a Source #

HasOptional OptionOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

optional :: (NotInAttrs OptOptional a (DuplicateAttrErr "optional"), NotInAttrs OptDefault a (IncompatibleAttrsErr "optional" "defaultVal")) => OptionOpt a a0 -> OptionOpt (OptOptional ': a) (Maybe a0) Source #

HasDefaultVal OptionOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

defaultVal :: (NotInAttrs OptDefault a (DuplicateAttrMultipleErr "defaultVal" ("defaultStr" ': ("required" ': []))), NotInAttrs OptOptional a (IncompatibleAttrsErr "defaultVal" "optional")) => a0 -> OptionOpt a a0 -> OptionOpt (OptDefault ': a) a0 Source #

HasRequired OptionOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

required :: (NotInAttrs OptDefault a (DuplicateAttrMultipleErr "required" ("defaultVal" ': ("defaultStr" ': []))), NotInAttrs OptOptional a (IncompatibleAttrsErr "required" "optional")) => OptionOpt a a0 -> OptionOpt (OptDefault ': a) a0 Source #

HasDefaultStr OptionOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

defaultStr :: (NotInAttrs OptDefault a (DuplicateAttrMultipleErr "defaultStr" ("defaultVal" ': ("required" ': []))), NotInAttrs OptOptional a (IncompatibleAttrsErr "defaultStr" "optional")) => String -> OptionOpt a a0 -> OptionOpt (OptDefault ': a) a0 Source #

HasEnvVar OptionOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

envVar :: String -> OptionOpt a a0 -> OptionOpt a a0 Source #

HasMetavar OptionOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

metavar :: String -> OptionOpt a a0 -> OptionOpt a a0 Source #

HasHelp OptionOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

help :: String -> OptionOpt a a0 -> OptionOpt a a0 Source #

HasShort OptionOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

short :: Char -> OptionOpt a a0 -> OptionOpt a a0 Source #

HasLong OptionOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

long :: String -> OptionOpt a a0 -> OptionOpt a a0 Source #

data FlagOpt (attr :: [OptAttr]) a Source #

Option for flags that act like switches between a default and an active value. Corresponds to flag.

Instances
IsOpt FlagOpt attr Source # 
Instance details

Defined in Options.Harg.Construct

Methods

toOpt :: FlagOpt attr a -> Opt a Source #

HasEnvVar FlagOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

envVar :: String -> FlagOpt a a0 -> FlagOpt a a0 Source #

HasHelp FlagOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

help :: String -> FlagOpt a a0 -> FlagOpt a a0 Source #

HasShort FlagOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

short :: Char -> FlagOpt a a0 -> FlagOpt a a0 Source #

HasLong FlagOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

long :: String -> FlagOpt a a0 -> FlagOpt a a0 Source #

data ArgumentOpt (attr :: [OptAttr]) a Source #

Option for arguments (no long/short specifiers). Corresponds to argument.

Instances
IsOpt ArgumentOpt attr Source # 
Instance details

Defined in Options.Harg.Construct

Methods

toOpt :: ArgumentOpt attr a -> Opt a Source #

HasOptional ArgumentOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

optional :: (NotInAttrs OptOptional a (DuplicateAttrErr "optional"), NotInAttrs OptDefault a (IncompatibleAttrsErr "optional" "defaultVal")) => ArgumentOpt a a0 -> ArgumentOpt (OptOptional ': a) (Maybe a0) Source #

HasDefaultVal ArgumentOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

defaultVal :: (NotInAttrs OptDefault a (DuplicateAttrMultipleErr "defaultVal" ("defaultStr" ': ("required" ': []))), NotInAttrs OptOptional a (IncompatibleAttrsErr "defaultVal" "optional")) => a0 -> ArgumentOpt a a0 -> ArgumentOpt (OptDefault ': a) a0 Source #

HasRequired ArgumentOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

required :: (NotInAttrs OptDefault a (DuplicateAttrMultipleErr "required" ("defaultVal" ': ("defaultStr" ': []))), NotInAttrs OptOptional a (IncompatibleAttrsErr "required" "optional")) => ArgumentOpt a a0 -> ArgumentOpt (OptDefault ': a) a0 Source #

HasDefaultStr ArgumentOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

defaultStr :: (NotInAttrs OptDefault a (DuplicateAttrMultipleErr "defaultStr" ("defaultVal" ': ("required" ': []))), NotInAttrs OptOptional a (IncompatibleAttrsErr "defaultStr" "optional")) => String -> ArgumentOpt a a0 -> ArgumentOpt (OptDefault ': a) a0 Source #

HasEnvVar ArgumentOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

envVar :: String -> ArgumentOpt a a0 -> ArgumentOpt a a0 Source #

HasMetavar ArgumentOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

metavar :: String -> ArgumentOpt a a0 -> ArgumentOpt a a0 Source #

HasHelp ArgumentOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

help :: String -> ArgumentOpt a a0 -> ArgumentOpt a a0 Source #

data OptError Source #

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.

Constructors

OptError 

Fields

data SomeOpt where Source #

Existential wrapper for Opt, so that many options can be carried in a list.

Constructors

SomeOpt :: Opt a -> SomeOpt 

type Environment = [(String, String)] Source #

Environment variable pairs, can be retrieved with getEnvironment.

type Args = [String] Source #

Command line arguments, can be retrieved with getArgs.

data HargCtx Source #

Context to carry around, that contains environment variables and command line arguments.

Constructors

HargCtx