EVP-0.1: Environment Variable Parser
Safe HaskellSafe-Inferred
LanguageGHC2021

EVP

Synopsis

Documentation

data Error Source #

Instances

Instances details
Show Error Source # 
Instance details

Defined in EVP.Internal

Methods

showsPrec :: Int -> Error -> ShowS #

show :: Error -> String #

showList :: [Error] -> ShowS #

Parsers

data Scan a Source #

Instances

Instances details
Applicative Scan Source # 
Instance details

Defined in EVP.Internal

Methods

pure :: a -> Scan a #

(<*>) :: Scan (a -> b) -> Scan a -> Scan b #

liftA2 :: (a -> b -> c) -> Scan a -> Scan b -> Scan c #

(*>) :: Scan a -> Scan b -> Scan b #

(<*) :: Scan a -> Scan b -> Scan a #

Functor Scan Source # 
Instance details

Defined in EVP.Internal

Methods

fmap :: (a -> b) -> Scan a -> Scan b #

(<$) :: a -> Scan b -> Scan a #

data Var a Source #

Constructors

Var 

Instances

Instances details
Typeable a => IsString (Var a) Source # 
Instance details

Defined in EVP

Methods

fromString :: String -> Var a #

Show a => Show (Var a) Source # 
Instance details

Defined in EVP

Methods

showsPrec :: Int -> Var a -> ShowS #

show :: Var a -> String #

showList :: [Var a] -> ShowS #

Eq a => Eq (Var a) Source # 
Instance details

Defined in EVP

Methods

(==) :: Var a -> Var a -> Bool #

(/=) :: Var a -> Var a -> Bool #

string :: (IsString a, Show a, Typeable a) => Var a -> Scan a Source #

Obtain the environment variable.

yaml :: forall a. (Show a, Typeable a, FromJSON a, ToJSON a) => Var a -> Scan a Source #

Parse the environment variable as a YAML value.

parse :: Show a => Var a -> (String -> Either String a) -> Scan a Source #

Parse the environment variable with a custom parser.

secret :: Scan a -> Scan a Source #

Disable logging of parsed values.

group :: String -> Scan a -> Scan a Source #

Give a name to a group of parsers.

defaultsTo :: Var a -> a -> Var a infixl 1 Source #

Provide a default value.

Runner

data Settings Source #

Constructors

Settings 

Fields

Instances

Instances details
Default Settings Source # 
Instance details

Defined in EVP

Methods

def :: Settings #

def :: Default a => a #

The default value for this type.

scan :: Scan a -> IO a Source #

Parse environment variables with the default settings.

scanWith :: Settings -> Scan a -> IO a Source #

Parse environment variables with custom settings.

enumerate :: Scan a -> [Name] Source #

Enumerate the names of the variables it would parse.

help :: Scan a -> String Source #

Display the list of environment variables and their default values in the dotenv format.

Logger

assumePrefix :: String -> Name -> Maybe (IO ()) Source #

Custom logging function for unusedLogger. assumePrefix p prints a warning for each unused environment variable prefixed by p.

obsolete :: [Name] -> Name -> Maybe (IO ()) Source #

obsolete names prints a warning if any of the names is set but not used.

Advanced

modifyError :: (Error -> Error) -> Scan a -> Scan a Source #