Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
Synopsis
- data ParseError
-
data
ParserInfo
a =
ParserInfo
{
- infoParser :: Parser a
- infoFullDesc :: Bool
- infoProgDesc :: Chunk Doc
- infoHeader :: Chunk Doc
- infoFooter :: Chunk Doc
- infoFailureCode :: Int
- infoPolicy :: ArgPolicy
- data ParserPrefs = ParserPrefs { }
-
data
Option
a =
Option
{
- optMain :: OptReader a
- optProps :: OptProperties
- data OptName
- isShortName :: OptName -> Bool
- isLongName :: OptName -> Bool
- data OptReader a
-
data
OptProperties
=
OptProperties
{
- propVisibility :: OptVisibility
- propHelp :: Chunk Doc
- propMetaVar :: String
- propShowDefault :: Maybe String
- propShowGlobal :: Bool
- propDescMod :: Maybe ( Doc -> Doc )
- data OptVisibility
- data Backtracking
-
newtype
ReadM
a =
ReadM
{
- unReadM :: ReaderT String ( Except ParseError ) a
- readerAsk :: ReadM String
- readerAbort :: ParseError -> ReadM a
- readerError :: String -> ReadM a
-
data
CReader
a =
CReader
{
- crCompleter :: Completer
- crReader :: ReadM a
- data Parser a
-
newtype
ParserM
r =
ParserM
{
- runParserM :: forall x. (r -> Parser x) -> Parser x
-
newtype
Completer
=
Completer
{
- runCompleter :: String -> IO [ String ]
- mkCompleter :: ( String -> IO [ String ]) -> Completer
-
newtype
CompletionResult
=
CompletionResult
{
- execCompletion :: String -> IO String
-
newtype
ParserFailure
h =
ParserFailure
{
- execFailure :: String -> (h, ExitCode , Int )
- data ParserResult a
- overFailure :: ( ParserHelp -> ParserHelp ) -> ParserResult a -> ParserResult a
- type Args = [ String ]
- data ArgPolicy
- newtype ArgumentReachability = ArgumentReachability { }
-
data
AltNodeType
- = MarkDefault
- | NoDefault
- data OptTree a
-
data
ParserHelp
=
ParserHelp
{
- helpError :: Chunk Doc
- helpSuggestions :: Chunk Doc
- helpHeader :: Chunk Doc
- helpUsage :: Chunk Doc
- helpDescription :: Chunk Doc
- helpBody :: Chunk Doc
- helpGlobals :: Chunk Doc
- helpFooter :: Chunk Doc
- data SomeParser = forall a. SomeParser ( Parser a)
- data Context = forall a. Context String ( ParserInfo a)
- data IsCmdStart
- fromM :: ParserM a -> Parser a
- oneM :: Parser a -> ParserM a
- manyM :: Parser a -> ParserM [a]
- someM :: Parser a -> ParserM [a]
- filterOptional :: OptTree a -> OptTree a
- optVisibility :: Option a -> OptVisibility
- optMetaVar :: Option a -> String
- optHelp :: Option a -> Chunk Doc
- optShowDefault :: Option a -> Maybe String
- optDescMod :: Option a -> Maybe ( Doc -> Doc )
Documentation
data ParseError Source #
ErrorMsg String | |
InfoMsg String | |
ShowHelpText ( Maybe String ) | |
UnknownError | |
MissingError IsCmdStart SomeParser | |
ExpectsArgError String | |
UnexpectedError String SomeParser |
Instances
Semigroup ParseError Source # | |
Defined in Options.Applicative.Types (<>) :: ParseError -> ParseError -> ParseError Source # sconcat :: NonEmpty ParseError -> ParseError Source # stimes :: Integral b => b -> ParseError -> ParseError Source # |
|
Monoid ParseError Source # | |
Defined in Options.Applicative.Types mempty :: ParseError Source # mappend :: ParseError -> ParseError -> ParseError Source # mconcat :: [ ParseError ] -> ParseError Source # |
data ParserInfo a Source #
A full description for a runnable
Parser
for a program.
ParserInfo | |
|
Instances
Functor ParserInfo Source # | |
Defined in Options.Applicative.Types fmap :: (a -> b) -> ParserInfo a -> ParserInfo b Source # (<$) :: a -> ParserInfo b -> ParserInfo a Source # |
data ParserPrefs Source #
Global preferences for a top-level
Parser
.
ParserPrefs | |
|
Instances
Eq ParserPrefs Source # | |
Defined in Options.Applicative.Types (==) :: ParserPrefs -> ParserPrefs -> Bool Source # (/=) :: ParserPrefs -> ParserPrefs -> Bool Source # |
|
Show ParserPrefs Source # | |
Defined in Options.Applicative.Types |
A single option of a parser.
Option | |
|
Instances
Eq OptName Source # | |
Ord OptName Source # | |
Defined in Options.Applicative.Types |
|
Show OptName Source # | |
isShortName :: OptName -> Bool Source #
isLongName :: OptName -> Bool Source #
An
OptReader
defines whether an option matches an command line argument.
data OptProperties Source #
Specification for an individual parser option.
OptProperties | |
|
Instances
Show OptProperties Source # | |
Defined in Options.Applicative.Types |
data OptVisibility Source #
Visibility of an option in the help text.
Internal |
does not appear in the help text at all |
Hidden |
only visible in the full description |
Visible |
visible both in the full and brief descriptions |
Instances
Eq OptVisibility Source # | |
Defined in Options.Applicative.Types (==) :: OptVisibility -> OptVisibility -> Bool Source # (/=) :: OptVisibility -> OptVisibility -> Bool Source # |
|
Ord OptVisibility Source # | |
Defined in Options.Applicative.Types compare :: OptVisibility -> OptVisibility -> Ordering Source # (<) :: OptVisibility -> OptVisibility -> Bool Source # (<=) :: OptVisibility -> OptVisibility -> Bool Source # (>) :: OptVisibility -> OptVisibility -> Bool Source # (>=) :: OptVisibility -> OptVisibility -> Bool Source # max :: OptVisibility -> OptVisibility -> OptVisibility Source # min :: OptVisibility -> OptVisibility -> OptVisibility Source # |
|
Show OptVisibility Source # | |
Defined in Options.Applicative.Types |
data Backtracking Source #
Instances
Eq Backtracking Source # | |
Defined in Options.Applicative.Types (==) :: Backtracking -> Backtracking -> Bool Source # (/=) :: Backtracking -> Backtracking -> Bool Source # |
|
Show Backtracking Source # | |
Defined in Options.Applicative.Types |
A newtype over 'ReaderT String Except', used by option readers.
readerAbort :: ParseError -> ReadM a Source #
Abort option reader by exiting with a
ParseError
.
readerError :: String -> ReadM a Source #
Abort option reader by exiting with an error message.
CReader | |
|
A
Parser a
is an option parser returning a value of type
a
.
NilP ( Maybe a) | |
OptP ( Option a) | |
forall x. MultP ( Parser (x -> a)) ( Parser x) | |
AltP ( Parser a) ( Parser a) | |
forall x. BindP ( Parser x) (x -> Parser a) |
ParserM | |
|
A shell complete function.
Completer | |
|
newtype CompletionResult Source #
Instances
Show CompletionResult Source # | |
Defined in Options.Applicative.Types |
newtype ParserFailure h Source #
ParserFailure | |
|
Instances
Functor ParserFailure Source # | |
Defined in Options.Applicative.Types fmap :: (a -> b) -> ParserFailure a -> ParserFailure b Source # (<$) :: a -> ParserFailure b -> ParserFailure a Source # |
|
Show h => Show ( ParserFailure h) Source # | |
Defined in Options.Applicative.Types |
data ParserResult a Source #
Result of
execParserPure
.
Instances
Monad ParserResult Source # | |
Defined in Options.Applicative.Types (>>=) :: ParserResult a -> (a -> ParserResult b) -> ParserResult b Source # (>>) :: ParserResult a -> ParserResult b -> ParserResult b Source # return :: a -> ParserResult a Source # |
|
Functor ParserResult Source # | |
Defined in Options.Applicative.Types fmap :: (a -> b) -> ParserResult a -> ParserResult b Source # (<$) :: a -> ParserResult b -> ParserResult a Source # |
|
Applicative ParserResult Source # | |
Defined in Options.Applicative.Types pure :: a -> ParserResult a Source # (<*>) :: ParserResult (a -> b) -> ParserResult a -> ParserResult b Source # liftA2 :: (a -> b -> c) -> ParserResult a -> ParserResult b -> ParserResult c Source # (*>) :: ParserResult a -> ParserResult b -> ParserResult b Source # (<*) :: ParserResult a -> ParserResult b -> ParserResult a Source # |
|
Show a => Show ( ParserResult a) Source # | |
Defined in Options.Applicative.Types |
overFailure :: ( ParserHelp -> ParserHelp ) -> ParserResult a -> ParserResult a Source #
Policy for how to handle options within the parse
Intersperse |
The default policy, options and arguments can be interspersed. A `--` option can be passed to ensure all following commands are treated as arguments. |
NoIntersperse |
Options must all come before arguments, once a
single positional argument or subcommand is parsed,
all remaining arguments are treated as positionals.
A `--` option can be passed if the first positional
one needs starts with
|
AllPositionals |
No options are parsed at all, all arguments are treated as positionals. Is the policy used after `--` is encountered. |
ForwardOptions |
Options and arguments can be interspersed, but if a given option is not found, it is treated as a positional argument. This is sometimes useful if one is passing through most options to another tool, but are supplying just a few of their own options. |
Instances
Eq ArgPolicy Source # | |
Ord ArgPolicy Source # | |
Defined in Options.Applicative.Types |
|
Show ArgPolicy Source # | |
newtype ArgumentReachability Source #
ArgumentReachability | |
|
Instances
Eq ArgumentReachability Source # | |
Defined in Options.Applicative.Types (==) :: ArgumentReachability -> ArgumentReachability -> Bool Source # (/=) :: ArgumentReachability -> ArgumentReachability -> Bool Source # |
|
Show ArgumentReachability Source # | |
Defined in Options.Applicative.Types |
data AltNodeType Source #
This type encapsulates whether an
AltNode
of an
OptTree
should be displayed
with brackets around it.
Instances
Eq AltNodeType Source # | |
Defined in Options.Applicative.Types (==) :: AltNodeType -> AltNodeType -> Bool Source # (/=) :: AltNodeType -> AltNodeType -> Bool Source # |
|
Show AltNodeType Source # | |
Defined in Options.Applicative.Types |
data ParserHelp Source #
ParserHelp | |
|
Instances
Show ParserHelp Source # | |
Defined in Options.Applicative.Help.Types |
|
Semigroup ParserHelp Source # | |
Defined in Options.Applicative.Help.Types (<>) :: ParserHelp -> ParserHelp -> ParserHelp Source # sconcat :: NonEmpty ParserHelp -> ParserHelp Source # stimes :: Integral b => b -> ParserHelp -> ParserHelp Source # |
|
Monoid ParserHelp Source # | |
Defined in Options.Applicative.Help.Types mempty :: ParserHelp Source # mappend :: ParserHelp -> ParserHelp -> ParserHelp Source # mconcat :: [ ParserHelp ] -> ParserHelp Source # |
data SomeParser Source #
forall a. SomeParser ( Parser a) |
Subparser context, containing the
name
of the subparser and its parser info.
Used by parserFailure to display relevant usage information when parsing inside a subparser fails.
forall a. Context String ( ParserInfo a) |
data IsCmdStart Source #
Instances
Show IsCmdStart Source # | |
Defined in Options.Applicative.Types |
filterOptional :: OptTree a -> OptTree a Source #
optVisibility :: Option a -> OptVisibility Source #
optMetaVar :: Option a -> String Source #