conferer-0.4.0.0: Configuration management library

Safe HaskellSafe
LanguageHaskell2010

Conferer.Types

Synopsis

Documentation

data Source Source #

Core interface for library provided configuration, basically consists of getting a Key and informing returning a maybe signaling the value and if it's present in that specific source

Constructors

Source 

Fields

newtype Key Source #

The way to index Sources, basically list of names that will be adapted to whatever the source needs

Constructors

Path 

Fields

Instances
Eq Key Source # 
Instance details

Defined in Conferer.Types

Methods

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

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

Ord Key Source # 
Instance details

Defined in Conferer.Types

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 #

Show Key Source # 
Instance details

Defined in Conferer.Types

Methods

showsPrec :: Int -> Key -> ShowS #

show :: Key -> String #

showList :: [Key] -> ShowS #

IsString Key Source # 
Instance details

Defined in Conferer.Types

Methods

fromString :: String -> Key #

keyName :: Key -> Text Source #

Collapse a key into a textual representation

data Config Source #

Core type that the user of this library interact with, in the future it may contain more this besides a list of sources

Constructors

Config 

Fields

type SourceCreator = Config -> IO Source Source #

The type for creating a source given a Config, some sources require a certain configuration to be initialized (for example: the redis source needs connection info to connect to the server)

class DefaultConfig a where Source #

Default defining instance

Here a Nothing means that the value didn't appear in the config, some instances never return a value since they have defaults that can never fail

Methods

configDef :: a Source #

Instances
DefaultConfig (Maybe a) Source # 
Instance details

Defined in Conferer.FromConfig.Basics

Methods

configDef :: Maybe a Source #

class FromConfig a where Source #

Main typeclass for defining the way to get values from config, hiding the Text based nature of the Sources. updated using a config, so for example a Warp.Settings can get updated from a config, but that doesn't make much sense for something like an Int

You'd normally would never implement this typeclass, if you want to implement FromConfig you should implement that directly, and if you want to use DefaultConfig and FromConfig to implement FromConfig you should let the default Generics based implementation do it's thing

Minimal complete definition

Nothing

Instances
FromConfig Bool Source # 
Instance details

Defined in Conferer.FromConfig.Basics

FromConfig Float Source # 
Instance details

Defined in Conferer.FromConfig.Basics

FromConfig Int Source # 
Instance details

Defined in Conferer.FromConfig.Basics

FromConfig Integer Source # 
Instance details

Defined in Conferer.FromConfig.Basics

FromConfig String Source # 
Instance details

Defined in Conferer.FromConfig.Basics

FromConfig ByteString Source # 
Instance details

Defined in Conferer.FromConfig.Basics

FromConfig Text Source # 
Instance details

Defined in Conferer.FromConfig.Basics

FromConfig a => FromConfig (Maybe a) Source # 
Instance details

Defined in Conferer.FromConfig.Basics

class FromConfigG f where Source #

Purely Generics machinery, ignore...

Methods

updateFromConfigG :: Key -> Config -> f a -> IO (f a) Source #

fetchFromConfigG :: Key -> Config -> IO (Maybe (f a)) Source #

Instances
FromConfig inner => FromConfigG (Rec0 inner) Source #

Purely Generics machinery, ignore...

Instance details

Defined in Conferer.FromConfig.Basics

Methods

updateFromConfigG :: Key -> Config -> Rec0 inner a -> IO (Rec0 inner a) Source #

fetchFromConfigG :: Key -> Config -> IO (Maybe (Rec0 inner a)) Source #

FromConfigG inner => FromConfigG (D1 metadata inner) Source # 
Instance details

Defined in Conferer.FromConfig.Basics

Methods

updateFromConfigG :: Key -> Config -> D1 metadata inner a -> IO (D1 metadata inner a) Source #

fetchFromConfigG :: Key -> Config -> IO (Maybe (D1 metadata inner a)) Source #

(FromConfigWithConNameG inner, Constructor constructor) => FromConfigG (C1 constructor inner) Source # 
Instance details

Defined in Conferer.FromConfig.Basics

Methods

updateFromConfigG :: Key -> Config -> C1 constructor inner a -> IO (C1 constructor inner a) Source #

fetchFromConfigG :: Key -> Config -> IO (Maybe (C1 constructor inner a)) Source #