does anyone have a very good use case for context ...
# getting-started
b
does anyone have a very good use case for context providers? to me it looks like a native Reader Monad and I don't really understand what it really offers over just using a class and constructors (or heck, partially applied functions)
1
c
What do you mean by context providers? Are you talking about context parameters?
b
Yes
c
There are lots of good examples
For DSLs in particular, they allow much more complex scope management that wasn't possible until now
b
I see haven't thought about that
y
It's more so a native reader effect. It composes extremely well and is unordered. A Reader monad transformer is inherently ordered; the same thing with partial application.
a
The example at the presentation yesterday was probably not the best, because it did not expose any real value. Can you provide a link to other examples?
c
j
I’m using it in a transactional API, where mutating methods can only be called during a transaction. Those methods take the txn as a context parameter, and the only way to get that context is within the closure of the
inTransaction { }
function.