Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
Synopsis
- data Mod f a = Mod (f a -> f a) (DefaultProp a) (OptProperties -> OptProperties)
- class HasName f where
- class HasCompleter f where
- modCompleter :: (Completer -> Completer) -> f a -> f a
- class HasValue f where
- hasValueDummy :: f a -> ()
- class HasMetavar f where
- hasMetavarDummy :: f a -> ()
- data OptionFields a = OptionFields {
- optNames :: [OptName]
- optCompleter :: Completer
- optNoArgError :: String -> ParseError
- data FlagFields a = FlagFields {
- flagNames :: [OptName]
- flagActive :: a
- data CommandFields a = CommandFields {
- cmdCommands :: [(String, ParserInfo a)]
- cmdGroup :: Maybe String
- data ArgumentFields a = ArgumentFields {}
- data DefaultProp a = DefaultProp (Maybe a) (Maybe (a -> String))
- optionMod :: (OptProperties -> OptProperties) -> Mod f a
- fieldMod :: (f a -> f a) -> Mod f a
- baseProps :: OptProperties
- mkCommand :: Mod CommandFields a -> (Maybe String, [(String, ParserInfo a)])
- mkParser :: DefaultProp a -> (OptProperties -> OptProperties) -> OptReader a -> Parser a
- mkOption :: DefaultProp a -> (OptProperties -> OptProperties) -> OptReader a -> Option a
- mkProps :: DefaultProp a -> (OptProperties -> OptProperties) -> OptProperties
- internal :: Mod f a
- noGlobal :: Mod f a
Internals
An option modifier.
Option modifiers are values that represent a modification of the properties of an option.
The type parameter a
is the return type of the option, while f
is a
record containing its properties (e.g. OptionFields
for regular options,
FlagFields
for flags, etc...).
An option modifier consists of 3 elements:
- A field modifier, of the form
f a -> f a
. These are essentially (compositions of) setters for some of the properties supported byf
. - An optional default value and function to display it.
- A property modifier, of the form
OptProperties -> OptProperties
. This is just like the field modifier, but for properties applicable to any option.
Modifiers are instances of Monoid
, and can be composed as such.
One rarely needs to deal with modifiers directly, as most of the times it is
sufficient to pass them to builders (such as strOption
or flag
) to
create options (see Builder
).
Mod (f a -> f a) (DefaultProp a) (OptProperties -> OptProperties) |
class HasName f where Source #
Instances
HasName FlagFields Source # | |
Defined in Options.Applicative.Builder.Internal name :: OptName -> FlagFields a -> FlagFields a Source # | |
HasName OptionFields Source # | |
Defined in Options.Applicative.Builder.Internal name :: OptName -> OptionFields a -> OptionFields a Source # |
class HasCompleter f where Source #
modCompleter :: (Completer -> Completer) -> f a -> f a Source #
Instances
HasCompleter ArgumentFields Source # | |
Defined in Options.Applicative.Builder.Internal modCompleter :: (Completer -> Completer) -> ArgumentFields a -> ArgumentFields a Source # | |
HasCompleter OptionFields Source # | |
Defined in Options.Applicative.Builder.Internal modCompleter :: (Completer -> Completer) -> OptionFields a -> OptionFields a Source # |
class HasValue f where Source #
hasValueDummy :: f a -> () Source #
Instances
HasValue ArgumentFields Source # | |
Defined in Options.Applicative.Builder.Internal hasValueDummy :: ArgumentFields a -> () Source # | |
HasValue OptionFields Source # | |
Defined in Options.Applicative.Builder.Internal hasValueDummy :: OptionFields a -> () Source # |
class HasMetavar f where Source #
hasMetavarDummy :: f a -> () Source #
Instances
HasMetavar ArgumentFields Source # | |
Defined in Options.Applicative.Builder.Internal hasMetavarDummy :: ArgumentFields a -> () Source # | |
HasMetavar CommandFields Source # | |
Defined in Options.Applicative.Builder.Internal hasMetavarDummy :: CommandFields a -> () Source # | |
HasMetavar OptionFields Source # | |
Defined in Options.Applicative.Builder.Internal hasMetavarDummy :: OptionFields a -> () Source # |
data OptionFields a Source #
OptionFields | |
|
Instances
HasCompleter OptionFields Source # | |
Defined in Options.Applicative.Builder.Internal modCompleter :: (Completer -> Completer) -> OptionFields a -> OptionFields a Source # | |
HasMetavar OptionFields Source # | |
Defined in Options.Applicative.Builder.Internal hasMetavarDummy :: OptionFields a -> () Source # | |
HasName OptionFields Source # | |
Defined in Options.Applicative.Builder.Internal name :: OptName -> OptionFields a -> OptionFields a Source # | |
HasValue OptionFields Source # | |
Defined in Options.Applicative.Builder.Internal hasValueDummy :: OptionFields a -> () Source # |
data FlagFields a Source #
FlagFields | |
|
Instances
HasName FlagFields Source # | |
Defined in Options.Applicative.Builder.Internal name :: OptName -> FlagFields a -> FlagFields a Source # |
data CommandFields a Source #
CommandFields | |
|
Instances
HasMetavar CommandFields Source # | |
Defined in Options.Applicative.Builder.Internal hasMetavarDummy :: CommandFields a -> () Source # |
data ArgumentFields a Source #
Instances
HasCompleter ArgumentFields Source # | |
Defined in Options.Applicative.Builder.Internal modCompleter :: (Completer -> Completer) -> ArgumentFields a -> ArgumentFields a Source # | |
HasMetavar ArgumentFields Source # | |
Defined in Options.Applicative.Builder.Internal hasMetavarDummy :: ArgumentFields a -> () Source # | |
HasValue ArgumentFields Source # | |
Defined in Options.Applicative.Builder.Internal hasValueDummy :: ArgumentFields a -> () Source # |
data DefaultProp a Source #
DefaultProp (Maybe a) (Maybe (a -> String)) |
Instances
Monoid (DefaultProp a) Source # | |
Defined in Options.Applicative.Builder.Internal mempty :: DefaultProp a # mappend :: DefaultProp a -> DefaultProp a -> DefaultProp a # mconcat :: [DefaultProp a] -> DefaultProp a # | |
Semigroup (DefaultProp a) Source # | |
Defined in Options.Applicative.Builder.Internal (<>) :: DefaultProp a -> DefaultProp a -> DefaultProp a # sconcat :: NonEmpty (DefaultProp a) -> DefaultProp a # stimes :: Integral b => b -> DefaultProp a -> DefaultProp a # |
optionMod :: (OptProperties -> OptProperties) -> Mod f a Source #
baseProps :: OptProperties Source #
Base default properties.
mkCommand :: Mod CommandFields a -> (Maybe String, [(String, ParserInfo a)]) Source #
mkParser :: DefaultProp a -> (OptProperties -> OptProperties) -> OptReader a -> Parser a Source #
mkOption :: DefaultProp a -> (OptProperties -> OptProperties) -> OptReader a -> Option a Source #
mkProps :: DefaultProp a -> (OptProperties -> OptProperties) -> OptProperties Source #
Hide this option completely from the help text
Use hidden
if the option should remain visible in the full description.