conftrack-0.0.1: Tracable multi-source config management
Safe HaskellSafe-Inferred
LanguageGHC2021

Conftrack.Value

Synopsis

Documentation

key :: QuasiQuoter Source #

to write values of Key easily

data Value Source #

A generic value read from a config source, to be parsed into a more useful type (see the ConfigValue class).

Constructors

ConfigString ByteString 
ConfigInteger Integer 
ConfigMaybeInteger ByteString Integer

A value which may be an integer, but the source cannot say for sure, e.g. because its values are entirely untyped. Use withString to handle such cases.

ConfigOther Text Text 
ConfigBool Bool 
ConfigNull 

Instances

Instances details
Show Value Source # 
Instance details

Defined in Conftrack.Value

Methods

showsPrec :: Int -> Value -> ShowS #

show :: Value -> String #

showList :: [Value] -> ShowS #

data ConfigError Source #

Instances

Instances details
Show ConfigError Source # 
Instance details

Defined in Conftrack.Value

newtype Key Source #

A configuration key is a non-empty list of parts. By convention, these parts are separated by dots when written, although dots withing parts are not disallowed.

For writing values easily, consider enabling the QuasiQuotes language extension to use key:

>>> [key|foo.bar|]
foo.bar

Constructors

Key (NonEmpty KeyPart) 

Instances

Instances details
Show Key Source # 
Instance details

Defined in Conftrack.Value

Methods

showsPrec :: Int -> Key -> ShowS #

show :: Key -> String #

showList :: [Key] -> ShowS #

Eq Key Source # 
Instance details

Defined in Conftrack.Value

Methods

(==) :: Key -> Key -> Bool #

(/=) :: Key -> Key -> Bool #

Ord Key Source # 
Instance details

Defined in Conftrack.Value

Methods

compare :: Key -> Key -> Ordering #

(<) :: Key -> Key -> Bool #

(<=) :: Key -> Key -> Bool #

(>) :: Key -> Key -> Bool #

(>=) :: Key -> Key -> Bool #

max :: Key -> Key -> Key #

min :: Key -> Key -> Key #

Lift Key Source # 
Instance details

Defined in Conftrack.Value

Methods

lift :: Quote m => Key -> m Exp #

liftTyped :: forall (m :: Type -> Type). Quote m => Key -> Code m Key #

class ConfigValue a where Source #

Values which can be read from a config source must implement this class

Minimal complete definition

fromConfig

Methods

fromConfig :: Value -> Either ConfigError a Source #

prettyValue :: a -> Text Source #

optionally, a function to pretty-print values of this type, used by the functions of Conftrack.Pretty. If not given, defaults to a's Show instance.

default prettyValue :: Show a => a -> Text Source #

data Origin Source #

Constructors

forall a.ConfigValue a => Origin a Text 

Instances

Instances details
Show Origin Source # 
Instance details

Defined in Conftrack.Value