cfg-0.0.2.2: Type directed application configuration parsing and accessors
Copyright© Jonathan Lorimer 2023
LicenseMIT
Maintainerjonathanlorimer@pm.me
Stabilitystable
Safe HaskellNone
LanguageHaskell2010

Cfg.Parser.Value

Description

This module contains the generic machinery for value parsers. The main use case for deriving ValueParser generically is for sum types, as instances for most common types are provided in Cfg.Parser.

Since: 0.0.2.0

Synopsis

Documentation

defaultValueParser :: (Generic a, GValueParser (Rep a)) => Parser a Source #

This is the function that hooks into the generic machinery. It is called by the deriving mechanism in Cfg.Deriving.Value.

Since: 0.0.2.0

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

This is a generic version of ValueParser

Since: 0.0.2.0

Methods

gParser :: Parser (f p) Source #

Instances

Instances details
GValueParser (U1 :: Type -> Type) Source #

Since: 0.0.2.0

Instance details

Defined in Cfg.Parser.Value

Methods

gParser :: Parser (U1 p) Source #

GValueParser (V1 :: Type -> Type) Source #

Since: 0.0.2.0

Instance details

Defined in Cfg.Parser.Value

Methods

gParser :: Parser (V1 p) Source #

(GValueParser a, GValueParser b) => GValueParser (a :*: b) Source #

This is also an important instance for product types with unnamed fields that are intended to be parsed as values (not nested configurations).

Since: 0.0.2.0

Instance details

Defined in Cfg.Parser.Value

Methods

gParser :: Parser ((a :*: b) p) Source #

(GValueParser a, GValueParser b) => GValueParser (a :+: b) Source #

This is the main instance, which distributs a value parser over a sum type using retry and alternative.

Since: 0.0.2.0

Instance details

Defined in Cfg.Parser.Value

Methods

gParser :: Parser ((a :+: b) p) Source #

ValueParser a => GValueParser (K1 R a :: Type -> Type) Source #

Since: 0.0.2.0

Instance details

Defined in Cfg.Parser.Value

Methods

gParser :: Parser (K1 R a p) Source #

Constructor c => GValueParser (M1 C c (U1 :: Type -> Type)) Source #

Since: 0.0.2.0

Instance details

Defined in Cfg.Parser.Value

Methods

gParser :: Parser (M1 C c (U1 :: Type -> Type) p) Source #

GValueParser f => GValueParser (M1 D s f) Source #

Since: 0.0.2.0

Instance details

Defined in Cfg.Parser.Value

Methods

gParser :: Parser (M1 D s f p) Source #

GValueParser f => GValueParser (M1 S s f) Source #

Since: 0.0.2.0

Instance details

Defined in Cfg.Parser.Value

Methods

gParser :: Parser (M1 S s f p) Source #