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.Options

Description

This module contains the options types that we pass to our generic functions. Mostly these are used for registering text transformations on keys, but another interesting use case is choosing between the type constructor and the data constructor for deriving a name for root keys.

Since: 0.0.2.0

Synopsis

Option Types

data KeyOptions Source #

Options that pertain to record field accessors.

Since: 0.0.1.0

Constructors

KeyOptions 

data RootKey a Source #

Type that represents a decision between using the type constructor name or the data constructor name as the root key.

This type is polymorphic so that we can use it to contain a term level text transformation for root keys, as well as be used at the type level parameterized by a type that defines the key modifiers to use.

Since: 0.0.2.0

Constructors

ConstructorName a 
TypeName a 

Instances

Instances details
(KeyModifier ('ConstructorName k2), KeyModifier f) => ConfigRootOptions ('ConstructorName k2 :: RootKey a) (f :: k1) Source #

Since: 0.0.2.0

Instance details

Defined in Cfg.Deriving.Config

(KeyModifier ('TypeName k2), KeyModifier f) => ConfigRootOptions ('TypeName k2 :: RootKey a) (f :: k1) Source #

Since: 0.0.2.0

Instance details

Defined in Cfg.Deriving.Config

KeyModifier k => KeyModifier ('ConstructorName k :: RootKey a) Source # 
Instance details

Defined in Cfg.Deriving.KeyModifier

KeyModifier k => KeyModifier ('TypeName k :: RootKey a) Source # 
Instance details

Defined in Cfg.Deriving.KeyModifier

data RootOptions Source #

Options for manipulating a root key

Since: 0.0.2.0

data ConfigOptions Source #

Represents all possible kinds of configuration options.

Since: 0.0.2.0

Helper Functions

defaultKeyOptions :: KeyOptions Source #

Default key options, does no transformation to record field accessors.

Since: 0.0.2.0

defaultRootOptions :: RootOptions Source #

Default root key option, uses the type constructor name for the root key and applies no transformations to the root key or keys derived from record fields.

Since: 0.0.2.0

defaultConfigOptions :: ConfigOptions Source #

Defaults to regular KeyOptions (not RootOptions)

Since: 0.0.2.0

keyModifier :: ConfigOptions -> Text -> Text Source #

Helper function that allows us to generically extract the record field modifiers from either a RootOptions or a KeyOptions record.

Since: 0.0.2.0