optparse-applicative-0.18.1.0: Utilities and combinators for parsing command line options

Safe Haskell | Safe-Inferred
Language | Haskell98

Options.Applicative.Builder.Internal

Contents

- Internals

Synopsis

- data Mod (f :: Type -> Type) a = Mod (f a -> f a) (DefaultProp a) (OptProperties -> OptProperties)
- class HasName (f :: Type -> Type) where
  - name :: OptName -> f a -> f a
- class HasCompleter (f :: Type -> Type) where
  - modCompleter :: (Completer -> Completer) -> f a -> f a
- class HasValue (f :: Type -> Type) where
  - hasValueDummy :: f a -> ()
- class HasMetavar (f :: Type -> Type) 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 {
  - argCompleter :: Completer
  }
- data DefaultProp a = DefaultProp (Maybe a) (Maybe (a -> String))
- optionMod :: forall (f :: Type -> Type) a. (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 :: forall (f :: Type -> Type) a. Mod f a
- noGlobal :: forall (f :: Type -> Type) a. Mod f a

# Internals

data Mod (f :: Type -> Type) a Source #

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 by `f`.
- 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`).

Constructors

Mod (f a -> f a) (DefaultProp a) (OptProperties -> OptProperties) |

#### Instances

Instances details

Monoid (Mod f a) Source # |
Instance details Defined in Options.Applicative.Builder.Internal Methods mempty :: Mod f a Source # mappend :: Mod f a -> Mod f a -> Mod f a Source # mconcat :: [Mod f a] -> Mod f a Source #
Semigroup (Mod f a) Source # | Since: 0.13.0.0
Instance details Defined in Options.Applicative.Builder.Internal Methods (<>) :: Mod f a -> Mod f a -> Mod f a Source # sconcat :: NonEmpty (Mod f a) -> Mod f a Source # stimes :: Integral b => b -> Mod f a -> Mod f a Source #

class HasName (f :: Type -> Type) where Source #

Methods

name :: OptName -> f a -> f a Source #

#### Instances

Instances details

HasName FlagFields Source # |
Instance details Defined in Options.Applicative.Builder.Internal Methods name :: OptName -> FlagFields a -> FlagFields a Source #
HasName OptionFields Source # |
Instance details Defined in Options.Applicative.Builder.Internal Methods name :: OptName -> OptionFields a -> OptionFields a Source #

class HasCompleter (f :: Type -> Type) where Source #

Methods

modCompleter :: (Completer -> Completer) -> f a -> f a Source #

#### Instances

Instances details

HasCompleter ArgumentFields Source # |
Instance details Defined in Options.Applicative.Builder.Internal Methods modCompleter :: (Completer -> Completer) -> ArgumentFields a -> ArgumentFields a Source #
HasCompleter OptionFields Source # |
Instance details Defined in Options.Applicative.Builder.Internal Methods modCompleter :: (Completer -> Completer) -> OptionFields a -> OptionFields a Source #

class HasValue (f :: Type -> Type) where Source #

Methods

hasValueDummy :: f a -> () Source #

#### Instances

Instances details

HasValue ArgumentFields Source # |
Instance details Defined in Options.Applicative.Builder.Internal Methods hasValueDummy :: ArgumentFields a -> () Source #
HasValue OptionFields Source # |
Instance details Defined in Options.Applicative.Builder.Internal Methods hasValueDummy :: OptionFields a -> () Source #

class HasMetavar (f :: Type -> Type) where Source #

Methods

hasMetavarDummy :: f a -> () Source #

#### Instances

Instances details

HasMetavar ArgumentFields Source # |
Instance details Defined in Options.Applicative.Builder.Internal Methods hasMetavarDummy :: ArgumentFields a -> () Source #
HasMetavar CommandFields Source # |
Instance details Defined in Options.Applicative.Builder.Internal Methods hasMetavarDummy :: CommandFields a -> () Source #
HasMetavar OptionFields Source # |
Instance details Defined in Options.Applicative.Builder.Internal Methods hasMetavarDummy :: OptionFields a -> () Source #

data OptionFields a Source #

Constructors

OptionFields |

Fields

- optNames :: [OptName]
- optCompleter :: Completer
- optNoArgError :: String -> ParseError

#### Instances

Instances details

HasCompleter OptionFields Source # |
Instance details Defined in Options.Applicative.Builder.Internal Methods modCompleter :: (Completer -> Completer) -> OptionFields a -> OptionFields a Source #
HasMetavar OptionFields Source # |
Instance details Defined in Options.Applicative.Builder.Internal Methods hasMetavarDummy :: OptionFields a -> () Source #
HasName OptionFields Source # |
Instance details Defined in Options.Applicative.Builder.Internal Methods name :: OptName -> OptionFields a -> OptionFields a Source #
HasValue OptionFields Source # |
Instance details Defined in Options.Applicative.Builder.Internal Methods hasValueDummy :: OptionFields a -> () Source #

data FlagFields a Source #

Constructors

FlagFields |

Fields

- flagNames :: [OptName]
- flagActive :: a

#### Instances

Instances details

HasName FlagFields Source # |
Instance details Defined in Options.Applicative.Builder.Internal Methods name :: OptName -> FlagFields a -> FlagFields a Source #

data CommandFields a Source #

Constructors

CommandFields |

Fields

- cmdCommands :: [(String, ParserInfo a)]
- cmdGroup :: Maybe String

#### Instances

Instances details

HasMetavar CommandFields Source # |
Instance details Defined in Options.Applicative.Builder.Internal Methods hasMetavarDummy :: CommandFields a -> () Source #

data ArgumentFields a Source #

Constructors

ArgumentFields |

Fields

- argCompleter :: Completer

#### Instances

Instances details

HasCompleter ArgumentFields Source # |
Instance details Defined in Options.Applicative.Builder.Internal Methods modCompleter :: (Completer -> Completer) -> ArgumentFields a -> ArgumentFields a Source #
HasMetavar ArgumentFields Source # |
Instance details Defined in Options.Applicative.Builder.Internal Methods hasMetavarDummy :: ArgumentFields a -> () Source #
HasValue ArgumentFields Source # |
Instance details Defined in Options.Applicative.Builder.Internal Methods hasValueDummy :: ArgumentFields a -> () Source #

data DefaultProp a Source #

Constructors

DefaultProp (Maybe a) (Maybe (a -> String)) |

#### Instances

Instances details

Monoid (DefaultProp a) Source # |
Instance details Defined in Options.Applicative.Builder.Internal Methods mempty :: DefaultProp a Source # mappend :: DefaultProp a -> DefaultProp a -> DefaultProp a Source # mconcat :: [DefaultProp a] -> DefaultProp a Source #
Semigroup (DefaultProp a) Source # |
Instance details Defined in Options.Applicative.Builder.Internal Methods (<>) :: DefaultProp a -> DefaultProp a -> DefaultProp a Source # sconcat :: NonEmpty (DefaultProp a) -> DefaultProp a Source # stimes :: Integral b => b -> DefaultProp a -> DefaultProp a Source #

optionMod :: forall (f :: Type -> Type) a. (OptProperties -> OptProperties) -> Mod f a Source #

fieldMod :: (f a -> f a) -> 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 #

internal :: forall (f :: Type -> Type) a. Mod f a Source #

Hide this option completely from the help text

Use `hidden` if the option should remain visible in the full description.

noGlobal :: forall (f :: Type -> Type) a. Mod f a Source #

Suppress this option from appearing in global options