Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- class FromEnv a where
- fromEnv :: MonadIO m => m (Either FromEnvError a)
- defaultEnvOpts :: FromEnvOptions
- data FromEnvOptions
- class GFromEnv a where
- gFromEnv :: MonadIO m => FromEnvOptions -> m (Either FromEnvError a)
- data FromEnvError
Core class
class FromEnv a where Source #
Class for things that can be created from environment variables.
Nothing
Options
defaultEnvOpts :: FromEnvOptions Source #
Default FromEnvOptions
:
The default options will try to read a field name fieldName from an environment variables FIELD_NAME, as this is the most common naming convention for environment variables.
If you want different behavior, see gFromEnv
.
FromEnvOptions
{optsFieldLabelModifier
= Just .screamingSnake
}
data FromEnvOptions Source #
Options to specify how to construct your datatype from environment variables.
Options can be set using record update syntax and defaultEnvOpts
.
Generic parsing class
class GFromEnv a where Source #
Nothing
gFromEnv :: MonadIO m => FromEnvOptions -> m (Either FromEnvError a) Source #
Try to construct a value from environment variables.
default gFromEnv :: (MonadIO m, Generic a, GFromEnv' (Rep a)) => FromEnvOptions -> m (Either FromEnvError a) Source #
Instances
(Generic a, GFromEnv' (Rep a)) => GFromEnv a Source # | |
Defined in System.Environment.FromEnv gFromEnv :: MonadIO m => FromEnvOptions -> m (Either FromEnvError a) Source # |
Errors
data FromEnvError Source #
UnsetVariable String | A field was unset in the environment |
FailedToParse String String | Failed to parse a given field from an environment variable |
AggregateError [FromEnvError] | There was more than one error. |
Instances
Show FromEnvError Source # | |
Defined in System.Environment.FromEnv showsPrec :: Int -> FromEnvError -> ShowS # show :: FromEnvError -> String # showList :: [FromEnvError] -> ShowS # | |
Eq FromEnvError Source # | |
Defined in System.Environment.FromEnv (==) :: FromEnvError -> FromEnvError -> Bool # (/=) :: FromEnvError -> FromEnvError -> Bool # |