{"id":15010922,"url":"https://github.com/meowgorithm/mr-env","last_synced_at":"2025-08-24T10:09:25.635Z","repository":{"id":56847567,"uuid":"247381408","full_name":"meowgorithm/mr-env","owner":"meowgorithm","description":"A simple way to read environment variables in Haskell","archived":false,"fork":false,"pushed_at":"2022-11-06T01:21:13.000Z","size":66,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-11T08:08:06.031Z","etag":null,"topics":["environment-variables","haskell"],"latest_commit_sha":null,"homepage":"https://hackage.haskell.org/package/mr-env-0.1.0.0","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/meowgorithm.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-15T01:29:31.000Z","updated_at":"2022-11-06T01:09:00.000Z","dependencies_parsed_at":"2023-01-21T01:52:07.234Z","dependency_job_id":null,"html_url":"https://github.com/meowgorithm/mr-env","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meowgorithm%2Fmr-env","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meowgorithm%2Fmr-env/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meowgorithm%2Fmr-env/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meowgorithm%2Fmr-env/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/meowgorithm","download_url":"https://codeload.github.com/meowgorithm/mr-env/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meowgorithm%2Fmr-env/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259227951,"owners_count":22824903,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["environment-variables","haskell"],"created_at":"2024-09-24T19:37:35.617Z","updated_at":"2025-06-11T08:08:06.413Z","avatar_url":"https://github.com/meowgorithm.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mr. Env\n\n![build][action-badge] [![Hackage][hackage-shield]][hackage]\n\n[action-badge]: https://github.com/meowgorithm/mr-env/workflows/build/badge.svg\n[hackage]: http://hackage.haskell.org/package/mr-env\n[hackage-shield]: https://img.shields.io/hackage/v/mr-env.svg?style=flat\u0026color=blueviolet\n\nA simple way to read environment variables in Haskell.\n\n```haskell\n-- Read environment variables, with defaults\nhost \u003c- envAsString \"HOST\" \"localhost\"\nport \u003c- envAsInt \"PORT\" 8000\n```\n\n## Simple Example\n\nRead environment variables with `do` notation:\n\n```haskell\nimport System.Environment.MrEnv ( envAsBool, envAsInt, envAsInteger, envAsString )\n\nmain :: IO ()\nmain = do\n\n    -- Get a string, with a fallback value if nothing is set.\n    host \u003c- envAsString \"HOST\" \"localhost\"\n\n    -- Get an int. If you need an integer instead you could also use envAsInteger.\n    port \u003c- envAsInt \"PORT\" 8000\n\n    -- Get a boolean. Here we're expecting the environment variable to read\n    -- something along the lines of \"true\", \"TRUE\", \"True\", \"truE\" and so on.\n    debug \u003c- envAsBool \"DEBUG\" False\n\n    putStrLn $\n        \"Let's connect to \"\n        ++ host\n        ++ \" on port \"\n        ++ show port\n        ++ \". Debug mode is \"\n        ++ if debug then \"on\" else \"off\"\n        ++ \".\"\n```\n\n## Fancy Example\n\nRead environment variables into a record:\n\n```haskell\nimport System.Environment.MrEnv ( envAsBool, envAsInt, envAsInteger, envAsString )\n\ndata Config =\n    Config { host  :: String\n           , port  :: Int\n           , debug :: Bool\n           }\n\ngetConfig :: IO Config\ngetConfig = Config\n    \u003c$\u003e envAsString \"HOST\" \"localhost\"\n    \u003c*\u003e envAsInt \"PORT\" 8000\n    \u003c*\u003e envAsBool \"DEBUG\" False\n\nmain :: IO ()\nmain =\n    getConfig \u003e\u003e= \\conf -\u003e\n        putStrLn $\n            \"Let's connect to \"\n            ++ host conf\n            ++ \" on port \"\n            ++ show $ port conf\n            ++ \". Debug mode is \"\n            ++ if debug conf then \"on\" else \"off\"\n            ++ \".\"\n```\n\nWe suggest pronouncing `\u003c*\u003e` _[brackety-splat][1]_ (as\nopposed to _ap_). In that vein, `\u003c$\u003e` is _brackety-cash._\n\n[1]: https://www.reddit.com/r/haskell/comments/241jcm/how_do_you_say/\n\n## Authors\n\n* [Christian Rocha](https://github.com/meowgorithm)\n* [Sam Raker](https://github.com/swizzard)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeowgorithm%2Fmr-env","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeowgorithm%2Fmr-env","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeowgorithm%2Fmr-env/lists"}