docrecords-0.1.0.0: Vinyl-based records with hierarchical field names, default values and documentation

Safe HaskellNone
LanguageHaskell2010

Data.DocRecord.OptParse

Synopsis

Documentation

class RecFromCLI a where Source #

Instances
(NamedField f, FieldWithTag Text f, FieldWithTag SourceTag f, FieldFromCLI (s :|: t), RecFromCLI (Rec f rs), ShowPath s) => RecFromCLI (Rec f ((s :|: t) ': rs)) Source # 
Instance details

Defined in Data.DocRecord.OptParse

Methods

parseRecFromCLI_ :: HashMap [Text] String -> Rec f ((s :|: t) ': rs) -> Parser (Rec f ((s :|: t) ': rs)) Source #

allPaths :: Rec f ((s :|: t) ': rs) -> [[Text]] Source #

RecFromCLI (Rec f ([] :: [PathWithType [Symbol] Type])) Source # 
Instance details

Defined in Data.DocRecord.OptParse

Methods

parseRecFromCLI_ :: HashMap [Text] String -> Rec f [] -> Parser (Rec f []) Source #

allPaths :: Rec f [] -> [[Text]] Source #

type FieldFromCLI a = FieldFromCLI_ (MarkerOf (Snd a)) a Source #

type RecordUsableWithCLI rs = (RecFromCLI (Rec (Tagged SourceTag `Compose` DocField) rs), ToJSONFields rs, FromJSON (Rec PossiblyEmptyField rs), RMap rs, RApply rs) Source #

Is satisfied when every field of a DocRec rs is transformable from & to JSON and gettable from the CLI.

data SourceTag Source #

Identifies the source of a value in the configuration, so that we can be sure to override the right values with the right values.

The Ord instance makes it so CLI overrides YAML and YAML overrides Default.

Constructors

Default 
YAML 
CLI 

type SourcedDocField = Tagged SourceTag `Compose` DocField Source #

A DocField with a Source tag attached

parseRecFromCLI :: forall (rs :: [PathWithType [Symbol] *]) f. RecFromCLI (Rec f rs) => Rec f rs -> Parser (Rec f rs) Source #