3 ms·
Plus, passing it via function parameters allows you to do things like currying (outside of the constructor case, I suppose) const foo = (env) => (arg1, arg2)
by _bxg1 7y ago
Plus, passing it via function parameters allows you to do things like currying (outside of the constructor case, I suppose)
const foo = (env) => (arg1, arg2) => {
...
}
const fooWithEnv = foo(myEnv)
- eru 7y agoThat's what the Reader Monad does under the hood. See eg https://eli.thegreenplace.net/2018/haskell-functions-as-functors-applicatives-and-monads/ https://eli.thegreenplace.net/2018/haskell-functions-as-func...