coalpit-0.1.1.0: Command-line options and DSV parsing and printing

Maintainerdefanor <defanor@uberspace.net>
Stabilityunstable
Portabilitynon-portable (uses GHC extensions)
Safe HaskellNone
LanguageHaskell2010

Coalpit.Core

Contents

Description

The Coalpit class with instances, a few functions to work with it, and Options are defined here.

Synopsis

Documentation

class Coalpit a where Source #

Coalpit class: parsing, printing, usage strings.

Methods

argParser :: Options -> Parser a Source #

argParser :: (Generic a, GCoalpit (Rep a)) => Options -> Parser a Source #

toArgs :: Options -> a -> [String] Source #

toArgs :: (Generic a, GCoalpit (Rep a)) => Options -> a -> [String] Source #

argHelper :: Options -> [String] -> Proxy a -> Usage Source #

argHelper :: GCoalpit (Rep a) => Options -> [String] -> Proxy a -> Usage Source #

Instances

Coalpit Bool Source # 
Coalpit Char Source # 
Coalpit Double Source # 
Coalpit Float Source # 
Coalpit Int Source # 
Coalpit Int8 Source # 
Coalpit Int16 Source # 
Coalpit Int32 Source # 
Coalpit Int64 Source # 
Coalpit Integer Source # 
Coalpit Natural Source # 
Coalpit Ordering Source # 
Coalpit Rational Source # 
Coalpit Word8 Source # 
Coalpit Word16 Source # 
Coalpit Word32 Source # 
Coalpit Word64 Source # 
Coalpit () Source # 
Coalpit Version Source # 
Coalpit ExitCode Source # 
Coalpit String Source # 
Coalpit Scientific Source # 
Coalpit URI Source #

An URI reference (absolute or relative).

Coalpit ZonedTime Source #

Uses dateTimeFormat.

Coalpit LocalTime Source #

Uses dateTimeFormat.

Coalpit TimeOfDay Source #

Uses timeFormat.

Coalpit UniversalTime Source #

Uses dateTimeFormat.

Coalpit UTCTime Source #

Uses dateTimeFormat.

Coalpit NominalDiffTime Source #

Converts to/from Scientific.

Coalpit DiffTime Source #

Converts to/from Scientific.

Coalpit Day Source #

Uses dateFormat.

Coalpit a => Coalpit [a] Source # 

Methods

argParser :: Options -> Parser [a] Source #

toArgs :: Options -> [a] -> [String] Source #

argHelper :: Options -> [String] -> Proxy * [a] -> Usage Source #

Coalpit a => Coalpit (Maybe a) Source # 
Coalpit a => Coalpit (Complex a) Source # 
Coalpit a => Coalpit (NonEmpty a) Source # 
(Coalpit a, Coalpit b) => Coalpit (Either a b) Source # 
(Coalpit a, Coalpit b) => Coalpit (a, b) Source # 

Methods

argParser :: Options -> Parser (a, b) Source #

toArgs :: Options -> (a, b) -> [String] Source #

argHelper :: Options -> [String] -> Proxy * (a, b) -> Usage Source #

(Coalpit a, Coalpit b, Coalpit c) => Coalpit (a, b, c) Source # 

Methods

argParser :: Options -> Parser (a, b, c) Source #

toArgs :: Options -> (a, b, c) -> [String] Source #

argHelper :: Options -> [String] -> Proxy * (a, b, c) -> Usage Source #

(Coalpit a, Coalpit b, Coalpit c, Coalpit d) => Coalpit (a, b, c, d) Source # 

Methods

argParser :: Options -> Parser (a, b, c, d) Source #

toArgs :: Options -> (a, b, c, d) -> [String] Source #

argHelper :: Options -> [String] -> Proxy * (a, b, c, d) -> Usage Source #

fromArgs :: Coalpit a => Options -> [String] -> Either String a Source #

Parses arguments.

Usage

data Usage Source #

Usage description: can be translated into help messages or documentation formats.

Constructors

UConstructor String

Data constructor.

URecursive String

Constructor of a recursive data structure (its second appearance in the tree).

USelector String Usage

Record selector.

UOptional Usage

Optional element.

USum Usage Usage

Sum.

UProduct Usage Usage

Product.

UUnit

Unit.

UType String

Type name, e.g. "INT".

Instances

usage :: Coalpit a => Options -> Proxy a -> Usage Source #

Composes Usage description.

usageString :: Coalpit a => Options -> Proxy a -> String Source #

Composes a usage string.

Options

data Options Source #

Printing and parsing options.

Constructors

Options 

Fields

defOpt :: Options Source #

Default options.