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

Safe HaskellSafe
LanguageHaskell98

Options.Applicative.Builder.Internal

Contents

Synopsis

Internals

data Mod f a

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.

You rarely need 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

Monoid (Mod f a) 

class HasName f where

Methods

name :: OptName -> f a -> f a

class HasValue f

Minimal complete definition

hasValueDummy

class HasMetavar f

Minimal complete definition

hasMetavarDummy

data FlagFields a

Constructors

FlagFields 

Fields

flagNames :: [OptName]
 
flagActive :: a
 

Instances

data CommandFields a

Constructors

CommandFields 

Fields

cmdCommands :: [(String, ParserInfo a)]
 

data DefaultProp a

Constructors

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

Instances

fieldMod :: (f a -> f a) -> Mod f a

baseProps :: OptProperties

Base default properties.

internal :: Mod f a

Hide this option from the help text