-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Constrained context functors #259
Comments
I did a prototype of the second idea ( After that, I guess I could rename it to
|
This is something we’ve definitely talked about a bit, e.g. #194 discusses data All m k = forall a . All (m a) ([a] -> k) In fact, we (long ago) weakened the superclass constraint on data Boolean value (m :: * -> *) k
= Boolean Bool (value -> m k)
| AsBool value (Bool -> m k) So in a sense, this hierarchy already exists, it’s just currently limited to I do think it’s worth exploring this space more, with a couple of caveats:
Parameterizing |
I've been thinking a bit more about
I completely agree with your points. I don't think the semigroupoids dependency is worth it, I was simply mentioning I have limited free time, but I am willing to help if I can, either by opening a PR based on my prototype or by submitting it to |
|
As a side note, I had some free time today to play with this on the relatively new Main changes:
|
Update GHC Update fused-effects (still custom fork, see fused-effects/fused-effects#259) Update README
I was trying to write an effect like this
The real scenario is a
Distributed
effect with a more complicated API where there is an interpreter-defined number of workers and a jobm
is computed in parallel (or sequentially). I believe that there is no escape in requiringf
in theEffect
instance to be anApplicative
(actually, justApply
fromsemigroupoids
because I require at least one execution withNonEmpty
).Do you think it is possible to define some hierarchy of
Effect
instances for different constraints onf
? In my opinion theApply
case is quite reasonable, as it would allow weaving the state ofEither e
orReader r
but notState s
(unlesss
is aSemigroup
!). The downside is that I can't see an easy (and flexible) fix for this:Effect
.Effect
class byf
?) would change the API and allCarrier
instances. However, this would allow interesting use cases, like serializing the monadic context or any other black magic the user may come up with (I haven't toyed with other classes to be honest).What do you think? Is it worth it?
The text was updated successfully, but these errors were encountered: