Comments (1)
@JonathanKnight I'd try something like this
parser :: Var b => Parser b
parser = (env <=< env) "DB_PROVIDER"
and to test
$ ghci
λ: import Control.Monad.Except
λ: import Control.Monad
λ: import System.Environment
λ: import System.Envy
λ: setEnv "DB_PROVIDER" "LOCAL_DB_PROVIDER"
λ: setEnv "LOCAL_DB_PROVIDER" "WHO HAH"
λ: Right (x :: String) <- runExceptT $ runParser (env <=< env $ "DB_PROVIDER")
λ: x
"WHO HAH"
cheers
from envy.
Related Issues (20)
- Generics would be sweet... HOT 4
- Allow using unit as an environment variable HOT 4
- Generics without def config HOT 9
- ToEnv purpose HOT 1
- write against MonadIO
- Error Compiling Example Program HOT 1
- No `Var` instance for `Last` HOT 1
- fromVar should return an Either String a HOT 3
- Dont't make implementors of FromEnv instance think of the default value HOT 7
- instances for tuples HOT 4
- Question: Semantics of `envMaybe` HOT 3
- provide a way to extract/print the names of environment variables used?
- Constraints on base are incorrect for 2.0 and 2.1 HOT 3
- Examples with DefConfig don't work
- envy-2.0.0.0 and 2.1.0.0: metadata revisions published to Hackage HOT 1
- Poor error messages for bool variables HOT 2
- What is the proper way of grouping env vars into product Haskell types?
- Relax dependency on bytestring HOT 5
- Race conditions in testing environmental variables HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from envy.