Copyright | © Jonathan Lorimer 2023 |
---|---|
License | MIT |
Maintainer | jonathanlorimer@pm.me |
Stability | stable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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
- data KeyOptions = KeyOptions {
- keyOptionsModifier :: Text -> Text
- data RootKey a
- = ConstructorName a
- | TypeName a
- data RootOptions = RootOptions {
- rootOptionsRootKey :: RootKey (Text -> Text)
- rootOptionsModifier :: Text -> Text
- data ConfigOptions
- defaultKeyOptions :: KeyOptions
- defaultRootOptions :: RootOptions
- defaultConfigOptions :: ConfigOptions
- keyModifier :: ConfigOptions -> Text -> Text
Option Types
data KeyOptions Source #
Options that pertain to record field accessors.
Since: 0.0.1.0
KeyOptions | |
|
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
Instances
(KeyModifier ('ConstructorName k2), KeyModifier f) => ConfigRootOptions ('ConstructorName k2 :: RootKey a) (f :: k1) Source # | Since: 0.0.2.0 |
Defined in Cfg.Deriving.Config | |
(KeyModifier ('TypeName k2), KeyModifier f) => ConfigRootOptions ('TypeName k2 :: RootKey a) (f :: k1) Source # | Since: 0.0.2.0 |
Defined in Cfg.Deriving.Config | |
KeyModifier k => KeyModifier ('ConstructorName k :: RootKey a) Source # | |
Defined in Cfg.Deriving.KeyModifier getKeyModifier :: Text -> Text Source # | |
KeyModifier k => KeyModifier ('TypeName k :: RootKey a) Source # | |
Defined in Cfg.Deriving.KeyModifier getKeyModifier :: Text -> Text Source # |
data RootOptions Source #
Options for manipulating a root key
Since: 0.0.2.0
RootOptions | |
|
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