-
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
Enable type-level distinctions between operations that thread state and those that don’t. #293
Comments
I was following along with some of the @KingoftheHomeless discusses the @KingoftheHomeless PR's these effects, along with the
|
Notably, |
I believe #296 gives us this capability. |
296 will close this, yes. |
So it looks like you said #296 would give us this capability but that PR was ultimately closed. I, like many others, are coming to this for the desire to be able to asyncify things that are effectively Identity wrappers. All the issues talking about this are dead-ended in some way. What's the state of the art knowledge on how to deal with this? EDIT: the desire is to retain the ability to have multiple interpretations, none of them need to have state in the context functor though |
@ProofOfKeags At the risk of sounding full of myself, the state of the art on this would be the approach taken by my newly released library: |
@KingoftheHomeless Cool that you were able to solve this. Can't say I'm a fan of trying to switch effect systems as a result of this, but I may still attempt to do so at some point. I was hoping I'd be able to patch fused-effects or restrict myself to some subset of the library in order to do be able to use async effects. |
It’s possible we could take the same approach in That’s not ideal, and it’s regrettably silent, but it does allow for sensible use if you keep that in mind: basically, you get to make and observe any sort of local state changes you want in the forked thread, so long as you remember that they’re not going to be magically synchronized back to the forking thread. Further, you can also use this sort of thing to set up some sort of synchronization mechanism to transport state changes across threads; I’m doing that in those projects, too. So all is not lost! |
I think this is definitely superior to straight up not having a polymorphic async effect. I think a big warning on the tin that says that the pure construction of state/writer won't propagate over async effects is something that most people would have the capacity to understand. |
In |
We removed the Resource effect in #268 because of its unlawful interactions with the
State
effect. This was the right move, but it is also a bummer, because theResource
effect is extremely useful.What would be ideal is a system like
polysemy
’sTactics
module, which used in concert withResource
and thewithLowerToIO
system provided by their forklift implementation. Failing that, it would be ideal to have some type-level mechanism that rejects calls to functions likeget
andput
inside a finally block:where this hypothetical
IsStatelessIn
construct is fulfilled byReader
but not byState
. Or something. Either approach would be acceptable to me; that would enable us to deprecatefused-effects-exceptions
and welcomeResource
back into the fold.The text was updated successfully, but these errors were encountered: