-
Notifications
You must be signed in to change notification settings - Fork 78
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
Translation between State & Reader effect doesnt seem to work anymore #16
Comments
On further thought I think similar problems would affect operations like
For this to work seem to require the compiler to infer:
My guess is that both these cases result from insufficient inference in the Member implicits. Reviewing them I see that there are now ~25 levels of implicit rules in 2.0. That scares me because I dont know if I'll ever understand it properly myself and I wonder if anyone but Eric could maintain that code. |
@benhutchison I am going to look at this example. I agree that implicits are scary in eff and I don't understand myself yet what's the minimal set of implicits which can make it all work. I have one question though. Do you require |
I really didn't think such a subtle change would get it to compile! Nice :) TBH I dont know if I need |
When you don't need to interpret effects but you just need to create them you use Then when we use the In your example it looks like the implicit using |
Hi Eric, I'll include for context another way I tried to write a State-Reader The name "AsState" is because its meant to wrap a Reader, representing its @ trait AsState[S] {
Compilation Failed -Ben On Mon, Sep 12, 2016 at 5:15 PM, Eric Torreborre notifications@github.com
|
I have another proposal Ben. I think your example does not compile because it doesn't define with enough precision the stack But I suspect that in your case the So I propose another approach where you can "massage" the I have published I have 2 options here:
|
Confirming that 2.0.0-RC7-20160912142717-c806d04 seems to work for me in I cant yet comment usefully on what to do with extract. Still getting used On Tue, Sep 13, 2016 at 12:37 AM, Eric Torreborre notifications@github.com
|
Cool, I'm closing this then. FYI I added the |
But thanks for finding a nice solution to transforming stacks via their On Wed, Sep 14, 2016 at 1:59 AM, Eric Torreborre notifications@github.com
|
Maybe I'll try to recap. You mostly need
I haven't a real use for I would like to propose an already finished "theory and practice of effects", but it looks like you are helping me discovering it along the way :-). |
Right, I think it just clicked into place for me.. If you do your interpreting at the top level, then inside the pure program Whereas if you want to interpret away effects inside the program, eg On Wed, Sep 14, 2016 at 4:33 PM, Eric Torreborre notifications@github.com
|
Yes, that's it. |
Some background: back in June I asked if it were possible to weaken a State effect down to a Reader, for pieces of code that only read some state, but do not write it back. IIRC @etorreborre showed me a technique on eff-cats gitter, which I started using a version of. Its requires extending the stack with a new
Reader
effect , which is syntactically a bit clumsy it did meet the goal.Since the 2.0 upgrade I cant get it to work, when there are other effects that need be in the stack. The
prepend
operation seems to hide the other effects in some way. The gist below is an attempt to simplify down a reproducible case of the problem Im hitting.https://gist.github.com/benhutchison/b5d8267a764a22ca893af078ba3a3a27
The text was updated successfully, but these errors were encountered: