Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- type Name = String
- data Error
- data Scan a
- data Var a = Var {}
- string :: (IsString a, Show a, Typeable a) => Var a -> Scan a
- yaml :: forall a. (Show a, Typeable a, FromJSON a, ToJSON a) => Var a -> Scan a
- parse :: Show a => Var a -> (String -> Either String a) -> Scan a
- secret :: Scan a -> Scan a
- group :: String -> Scan a -> Scan a
- defaultsTo :: Var a -> a -> Var a
- data Settings = Settings {
- parseLogger :: GroupStack -> Name -> String -> IO ()
- errorLogger :: GroupStack -> Error -> IO ()
- unusedLogger :: Name -> Maybe (IO ())
- pedantic :: Bool
- helpFlag :: Maybe Name
- def :: Default a => a
- scan :: Scan a -> IO a
- scanWith :: Settings -> Scan a -> IO a
- enumerate :: Scan a -> [Name]
- help :: Scan a -> String
- type GroupStack = [String]
- renderError :: Error -> String
- assumePrefix :: String -> Name -> Maybe (IO ())
- obsolete :: [Name] -> Name -> Maybe (IO ())
- modifyError :: (Error -> Error) -> Scan a -> Scan a
Documentation
Parsers
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.
defaultsTo :: Var a -> a -> Var a infixl 1 Source #
Provide a default value.
Runner
Settings | |
|
help :: Scan a -> String Source #
Display the list of environment variables and their default values in the dotenv format.
Logger
type GroupStack = [String] Source #
renderError :: Error -> String Source #
assumePrefix :: String -> Name -> Maybe (IO ()) Source #
Custom logging function for unusedLogger
.
prints a warning for each unused environment variable prefixed by assumePrefix
pp
.
obsolete :: [Name] -> Name -> Maybe (IO ()) Source #
prints a warning if any of the obsolete
namesnames
is set but not used.