envy
envy copied to clipboard
Poor error messages for bool variables
Parsing a bool variable, not only does "true"
not work as a value, but the error message is not helpful in finding out that I should specify "True"
:
Parse failure: could not parse variable "TEST_BOOL" into type [Char]
yea, it just uses the Read
instance for Bool
.
instance Var Bool where toVar = show; fromVar = readMaybe
You can make your own though.
newtype Thing = Thing Bool
instance FromEnv Thing where
fromEnv _ = fmap Thing $ (True <$ (env "true" <|> env "True")) <|> (False <$ (env "false" <|> env "False"))