Safe Haskell | None |
---|---|
Language | Haskell98 |
- type OptionParser a = P (Str Char String Int) a
- type Option a = Gram (P (Str Char String Int)) a
- type BaseEntry s d = forall m r b. 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 :: (IsLocationUpdatedBy loc Char, ListLike state Char) => P (Str Char state loc) a -> P (Str Char state loc) a
- pString :: (IsLocationUpdatedBy loc Char, ListLike state Char) => P (Str Char state loc) [Char]
- pBool :: (IsLocationUpdatedBy loc Char, ListLike state Char) => P (Str Char state loc) Bool
- oG :: (Splittable f, MonadState a m, Functor 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 :: (ShowParserType a, MonadState [a] m) => (m () -> StateT [b1] Identity b) -> ([Char], P (Str Char String Int) a, [Char]) -> (Gram (P (Str Char String Int)) (b2 -> b1), [Char])
- optionsf :: (ShowParserType a, MonadState [a] m) => (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 = forall m r b. MonadState s m => (m () -> StateT r Identity b) -> d -> (Gram (P (Str Char String Int)) (r -> r), [Char]) Source
class ShowParserType a where Source
showType :: OptionParser a -> String Source
data OptionResult a Source
lexeme :: (IsLocationUpdatedBy loc Char, ListLike state Char) => P (Str Char state loc) a -> P (Str Char state loc) a Source
pString :: (IsLocationUpdatedBy loc Char, ListLike state Char) => P (Str Char state loc) [Char] Source
oG :: (Splittable f, MonadState a m, Functor 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 entry 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 :: (ShowParserType a, MonadState [a] m) => (m () -> StateT [b1] Identity b) -> ([Char], P (Str Char String Int) a, [Char]) -> (Gram (P (Str Char String Int)) (b2 -> b1), [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 :: (ShowParserType a, MonadState [a] m) => (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
choose :: EntryVals a a Source
A choose
entry introduces a list of choices for the specific entry; precisely 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