pbrisbin · GitHub

Sample code:

loadConfig :: IO String
loadConfig = Env.parse id $ Env.var Env.str "STR" mempty
main :: IO ()
main = do
    print =<< loadConfig
    print =<< loadConfig

Expected outcome

% stack build && STR=str stack exec example
"str"
"str"

Actual outcome:

% stack build && STR=str stack exec example
"str"
Available environment variables:
  STR
Parsing errors:
  STR is unset

This is breaking things for me because my app loads configuration from the environment at startup, and we load a new App value for each of our test cases. So the first test case reads the environment, unsets everything, then subsequent test cases fail.

Read the original on github.com ↗