Copyright | (c) 2020 IIJ Innovation Institute Inc. |
---|---|
License | BSD3 |
Maintainer | YAMAMOTO Yuji <yuji-yamamoto@iij.ad.jp> |
Stability | Experimental |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- recordFromEnvWith :: forall (xs :: [Assoc Symbol Type]) h. Forall (KeyTargetAre KnownSymbol (Instance1 Var h)) xs => FieldLabelToEnvName -> Parser (RecordOf h xs)
- recordFromEnv :: forall (xs :: [Assoc Symbol Type]) h. Forall (KeyTargetAre KnownSymbol (Instance1 Var h)) xs => Parser (RecordOf h xs)
- type FieldLabelToEnvName = String -> String
- defaultFieldLabelToEnvName :: String -> FieldLabelToEnvName
- camelToUpperSnakeCase :: FieldLabelToEnvName
Documentation
recordFromEnvWith :: forall (xs :: [Assoc Symbol Type]) h. Forall (KeyTargetAre KnownSymbol (Instance1 Var h)) xs => FieldLabelToEnvName -> Parser (RecordOf h xs) Source #
recordFromEnv :: forall (xs :: [Assoc Symbol Type]) h. Forall (KeyTargetAre KnownSymbol (Instance1 Var h)) xs => Parser (RecordOf h xs) Source #
recordFromEnv = recordFromEnvWith $ defaultFieldLabelToEnvName ""
type FieldLabelToEnvName = String -> String Source #
defaultFieldLabelToEnvName :: String -> FieldLabelToEnvName Source #
The default of FieldLabelToEnvName
.
If the first argument is empty, just convert the field label
(second argument) into UPPER_SNAKE_CASE
.
>>>
defaultFieldLabelToEnvName "" "thisIsATest"
"THIS_IS_A_TEST"
Otherwise, convert the field label into UPPER_SNAKE_CASE
,
then prepend the first argument with an underscore _
.
>>>
defaultFieldLabelToEnvName "PREFIXED" "thisIsATest"
"PREFIXED_THIS_IS_A_TEST"
camelToUpperSnakeCase :: FieldLabelToEnvName Source #
Used internally in defaultFieldLabelToEnvName
.
Published for your convenience.