richenv-0.1.0.0: Rich environment variable setup for Haskell
Safe HaskellSafe-Inferred
LanguageHaskell2010

RichEnv.Types

Description

This module contains the basic types used by the library and their typeclass instances.

Synopsis

Types

data RichEnv Source #

Type that represents a set of rules that generate environment variables. A value of this type can be retrieved from a configuration file (e.g. YAML) due to its FromJSON instance, or persisted into one with ToJSON.

Constructors

RichEnv 

Fields

  • values :: Values

    A list of environment variables to be set with their values.

  • mappings :: Mappings

    Mappings from one existing environment variable name to another.

  • prefixes :: Prefixes

    Mappings from different prefixes of existing environment variables to new prefixes.

Instances

Instances details
FromJSON RichEnv Source # 
Instance details

Defined in RichEnv.Types

ToJSON RichEnv Source # 
Instance details

Defined in RichEnv.Types

Monoid RichEnv Source # 
Instance details

Defined in RichEnv.Types

Semigroup RichEnv Source # 
Instance details

Defined in RichEnv.Types

Generic RichEnv Source # 
Instance details

Defined in RichEnv.Types

Associated Types

type Rep RichEnv :: Type -> Type #

Methods

from :: RichEnv -> Rep RichEnv x #

to :: Rep RichEnv x -> RichEnv #

Show RichEnv Source # 
Instance details

Defined in RichEnv.Types

Eq RichEnv Source # 
Instance details

Defined in RichEnv.Types

Methods

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

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

type Rep RichEnv Source # 
Instance details

Defined in RichEnv.Types

type Rep RichEnv = D1 ('MetaData "RichEnv" "RichEnv.Types" "richenv-0.1.0.0-KNQ9gi9XpkMBNNgyRGREMU" 'False) (C1 ('MetaCons "RichEnv" 'PrefixI 'True) (S1 ('MetaSel ('Just "values") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Values) :*: (S1 ('MetaSel ('Just "mappings") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Mappings) :*: S1 ('MetaSel ('Just "prefixes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Prefixes))))

defaultRichEnv :: RichEnv Source #

Default RichEnv value. With everything empty.

type Environment = [(Text, Text)] Source #

A list of key-value pairs representing environment variables.

newtype Mappings Source #

A list of key-value pairs representing environment variable name mappings. The internal representation is a 'HashMap Text Text', where the key is the final variable name and the value is the current one which will be replaced.

Constructors

Mappings 

Instances

Instances details
FromJSON Mappings Source # 
Instance details

Defined in RichEnv.Types.Mappings

ToJSON Mappings Source # 
Instance details

Defined in RichEnv.Types.Mappings

Monoid Mappings Source # 
Instance details

Defined in RichEnv.Types.Mappings

Semigroup Mappings Source # 
Instance details

Defined in RichEnv.Types.Mappings

Generic Mappings Source # 
Instance details

Defined in RichEnv.Types.Mappings

Associated Types

type Rep Mappings :: Type -> Type #

Methods

from :: Mappings -> Rep Mappings x #

to :: Rep Mappings x -> Mappings #

Show Mappings Source # 
Instance details

Defined in RichEnv.Types.Mappings

Eq Mappings Source # 
Instance details

Defined in RichEnv.Types.Mappings

type Rep Mappings Source # 
Instance details

Defined in RichEnv.Types.Mappings

type Rep Mappings = D1 ('MetaData "Mappings" "RichEnv.Types.Mappings" "richenv-0.1.0.0-KNQ9gi9XpkMBNNgyRGREMU" 'True) (C1 ('MetaCons "Mappings" 'PrefixI 'True) (S1 ('MetaSel ('Just "unMappings") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (HashMap Text Text))))

newtype Values Source #

A list of key-value pairs representing environment variables. The internal representation is a 'HashMap Text Text', where the key is the variable name and the value is the variable value.

Constructors

Values 

Instances

Instances details
FromJSON Values Source # 
Instance details

Defined in RichEnv.Types.Values

ToJSON Values Source # 
Instance details

Defined in RichEnv.Types.Values

Monoid Values Source # 
Instance details

Defined in RichEnv.Types.Values

Semigroup Values Source # 
Instance details

Defined in RichEnv.Types.Values

Generic Values Source # 
Instance details

Defined in RichEnv.Types.Values

Associated Types

type Rep Values :: Type -> Type #

Methods

from :: Values -> Rep Values x #

to :: Rep Values x -> Values #

Show Values Source # 
Instance details

Defined in RichEnv.Types.Values

Eq Values Source # 
Instance details

Defined in RichEnv.Types.Values

Methods

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

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

type Rep Values Source # 
Instance details

Defined in RichEnv.Types.Values

type Rep Values = D1 ('MetaData "Values" "RichEnv.Types.Values" "richenv-0.1.0.0-KNQ9gi9XpkMBNNgyRGREMU" 'True) (C1 ('MetaCons "Values" 'PrefixI 'True) (S1 ('MetaSel ('Just "unValues") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (HashMap Text Text))))

newtype Prefixes Source #

A list of key-value pairs representing environment variable name prefix mappings. The internal representation is a 'HashMap Text [Text]', where the key is the final prefix and the value is the list of prefixes that will be replaced.

Constructors

Prefixes 

Instances

Instances details
FromJSON Prefixes Source # 
Instance details

Defined in RichEnv.Types.Prefixes

ToJSON Prefixes Source # 
Instance details

Defined in RichEnv.Types.Prefixes

Monoid Prefixes Source # 
Instance details

Defined in RichEnv.Types.Prefixes

Semigroup Prefixes Source # 
Instance details

Defined in RichEnv.Types.Prefixes

Generic Prefixes Source # 
Instance details

Defined in RichEnv.Types.Prefixes

Associated Types

type Rep Prefixes :: Type -> Type #

Methods

from :: Prefixes -> Rep Prefixes x #

to :: Rep Prefixes x -> Prefixes #

Show Prefixes Source # 
Instance details

Defined in RichEnv.Types.Prefixes

Eq Prefixes Source # 
Instance details

Defined in RichEnv.Types.Prefixes

type Rep Prefixes Source # 
Instance details

Defined in RichEnv.Types.Prefixes

type Rep Prefixes = D1 ('MetaData "Prefixes" "RichEnv.Types.Prefixes" "richenv-0.1.0.0-KNQ9gi9XpkMBNNgyRGREMU" 'True) (C1 ('MetaCons "Prefixes" 'PrefixI 'True) (S1 ('MetaSel ('Just "unPrefixes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (HashMap Text [Text]))))

Environment transformations

toEnvironment :: [(String, String)] -> Environment Source #

Transform the type returned from getEnvironment ([(String, String)]) to use Text instead.

fromEnvironment :: Environment -> [(String, String)] Source #

Get back a [(String, String)] from an Environment.