
readEnvironment :: IO Environment
readEnvironment = do
  environment0 <- decodeFileEither environmentName :: IO (Either ParseException Environment)
  return $ case environment0 of
              Right v -> v
              Left _ -> emptyEnvironment

writeEnvironment :: Environment -> IO Environment
writeEnvironment environment = do
  encodeFile environmentName environment
  return environment
