harg-0.2.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

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

HasDefault OptionOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

optDefault :: (NotInAttrs OptDefault a (DuplicateAttrMultipleErr "optDefault" ("optDefaultStr" ': ("optRequired" ': []))), NotInAttrs OptOptional a (IncompatibleAttrsErr "optDefault" "optOptional")) => a0 -> OptionOpt a a0 -> OptionOpt (OptDefault ': a) a0 Source #

HasRequired OptionOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

optRequired :: (NotInAttrs OptDefault a (DuplicateAttrMultipleErr "optRequired" ("optDefault" ': ("optDefaultStr" ': []))), NotInAttrs OptOptional a (IncompatibleAttrsErr "optRequired" "optOptional")) => OptionOpt a a0 -> OptionOpt (OptDefault ': a) a0 Source #

HasDefaultStr OptionOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

optDefaultStr :: (NotInAttrs OptDefault a (DuplicateAttrMultipleErr "optDefaultStr" ("optDefault" ': ("optRequired" ': []))), NotInAttrs OptOptional a (IncompatibleAttrsErr "optDefaultStr" "optOptional")) => String -> OptionOpt a a0 -> OptionOpt (OptDefault ': a) a0 Source #

HasEnvVar OptionOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

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

HasMetavar OptionOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

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

HasHelp OptionOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

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

HasShort OptionOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

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

HasLong OptionOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

optLong :: 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

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

HasHelp FlagOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

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

HasShort FlagOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

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

HasLong FlagOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

optLong :: 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

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

HasDefault ArgumentOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

optDefault :: (NotInAttrs OptDefault a (DuplicateAttrMultipleErr "optDefault" ("optDefaultStr" ': ("optRequired" ': []))), NotInAttrs OptOptional a (IncompatibleAttrsErr "optDefault" "optOptional")) => a0 -> ArgumentOpt a a0 -> ArgumentOpt (OptDefault ': a) a0 Source #

HasRequired ArgumentOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

optRequired :: (NotInAttrs OptDefault a (DuplicateAttrMultipleErr "optRequired" ("optDefault" ': ("optDefaultStr" ': []))), NotInAttrs OptOptional a (IncompatibleAttrsErr "optRequired" "optOptional")) => ArgumentOpt a a0 -> ArgumentOpt (OptDefault ': a) a0 Source #

HasDefaultStr ArgumentOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

optDefaultStr :: (NotInAttrs OptDefault a (DuplicateAttrMultipleErr "optDefaultStr" ("optDefault" ': ("optRequired" ': []))), NotInAttrs OptOptional a (IncompatibleAttrsErr "optDefaultStr" "optOptional")) => String -> ArgumentOpt a a0 -> ArgumentOpt (OptDefault ': a) a0 Source #

HasEnvVar ArgumentOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

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

HasMetavar ArgumentOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

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

HasHelp ArgumentOpt a Source # 
Instance details

Defined in Options.Harg.Construct

Methods

optHelp :: 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