Safe Haskell | None |
---|
- type OptionParser a = P (Str Char String Int) a
- type Option a = Gram (P (Str Char String Int)) a
- type BaseEntry s d = MonadState s m => (m () -> StateT r Identity b) -> d -> (Gram (P (Str Char String Int)) (r -> r), [Char])
- type Entry s a = ShowParserType a => BaseEntry s ([Char], P (Str Char String Int) a, String)
- type EntryVal s a = ShowParserType a => BaseEntry s ([Char], a, String)
- type EntryVals s a = ShowParserType a => BaseEntry s [([Char], a, String)]
- class ShowParserType a where
- showType :: OptionParser a -> String
- data OptionResult a
- lexeme :: (ListLike state Char, IsLocationUpdatedBy loc Char) => P (Str Char state loc) a -> P (Str Char state loc) a
- pString :: (ListLike state Char, IsLocationUpdatedBy loc Char) => P (Str Char state loc) [Char]
- pBool :: (ListLike state Char, IsLocationUpdatedBy loc Char) => P (Str Char state loc) Bool
- oG :: (Functor f, MonadState a m, Splittable f) => f (a -> a) -> (m () -> StateT r Identity b) -> Gram f (r -> r)
- required_ :: MonadState a m => (m () -> StateT r Identity b) -> ([Char], OptionParser (a -> a), String, String, String) -> (Gram (P (Str Char String Int)) (r -> r), [Char])
- required :: Entry a a
- option :: Entry a a
- options :: Entry [a] a
- optionsl :: (MonadState [a] m, ShowParserType a) => (m () -> StateT [c] Identity b) -> ([Char], P (Str Char String Int) a, [Char]) -> (Gram (P (Str Char String Int)) ([c] -> c), [Char])
- optionsf :: (MonadState [a] m, ShowParserType a) => (m () -> StateT [c] Identity b) -> ([Char], P (Str Char String Int) a, [Char]) -> (Gram (P (Str Char String Int)) ([c] -> c), [Char])
- flag :: EntryVal a a
- flags :: EntryVals a a
- set :: EntryVal a a
- choose :: EntryVals a a
- change :: EntryVals a a
- field :: (Functor f, MonadState a m) => (m () -> StateT r Identity b) -> (f (a -> a), t) -> (f (r -> r), t)
- run :: a -> (Gram (P (Str Char String Int)) (a -> a), String) -> String -> Either (OptionResult a) [Char]
Documentation
type BaseEntry s d = MonadState s m => (m () -> StateT r Identity b) -> d -> (Gram (P (Str Char String Int)) (r -> r), [Char])Source
class ShowParserType a whereSource
showType :: OptionParser a -> StringSource
data OptionResult a Source
lexeme :: (ListLike state Char, IsLocationUpdatedBy loc Char) => P (Str Char state loc) a -> P (Str Char state loc) aSource
pString :: (ListLike state Char, IsLocationUpdatedBy loc Char) => P (Str Char state loc) [Char]Source
oG :: (Functor f, MonadState a m, Splittable f) => f (a -> a) -> (m () -> StateT r Identity b) -> Gram f (r -> r)Source
required_ :: MonadState a m => (m () -> StateT r Identity b) -> ([Char], OptionParser (a -> a), String, String, String) -> (Gram (P (Str Char String Int)) (r -> r), [Char])Source
an option
entry specied an enetry which may be provided; if absent the default value is taken
An options
entry specifies an element which may occur more than once. The final value contains the list of all the values encountered.
optionsl :: (MonadState [a] m, ShowParserType a) => (m () -> StateT [c] Identity b) -> ([Char], P (Str Char String Int) a, [Char]) -> (Gram (P (Str Char String Int)) ([c] -> c), [Char])Source
An optionl
entry specifies an element which may occur more than once. The last one encountered is taken
optionsl :: Entry a a
optionsf :: (MonadState [a] m, ShowParserType a) => (m () -> StateT [c] Identity b) -> ([Char], P (Str Char String Int) a, [Char]) -> (Gram (P (Str Char String Int)) ([c] -> c), [Char])Source
An optionf
entry specifies an element which may occur more than once. The first one encountered is taken
optionsf :: Entry a a
A flags
entry introduces a list of possible parameters, each with a value to which the field should be set
A choose
entry introduces a list of choices for the specific entry; at least one should be given
field :: (Functor f, MonadState a m) => (m () -> StateT r Identity b) -> (f (a -> a), t) -> (f (r -> r), t)Source
A field
entry introduces a collection of options which are used to set fields in a sub-record of the main record
:: a | the record containing the default values |
-> (Gram (P (Str Char String Int)) (a -> a), String) | the specification of the various options |
-> String | The string containing the given options, separated by EOT |
-> Either (OptionResult a) [Char] | The result is either an updated record ( |
The function run
equips the given option specification with an option to ask for --help
. It concatenates the files coming from the command line and terminates them with an EOT.
Make sure your command line arguments do not contain an EOT. It parses the command line arguments and updates the `default` record passed to it