-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
MonadError[StateT[F, S, ?]] doesn't handle errors in outer effect #1640
Comments
Whoops, I think am the one to blame. Do you want to open a PR? |
It's on my stack of things. If it sits for a few days, I'll probably get to it. :-) |
As a sidebar, the |
related #1616 |
I'm looking into this. |
As pointed out [here](typelevel#1640 (comment)) This reveals law violations in `StateT`. It looks like `flatMap`/`ap` consistency does not hold, as well as `MonadCombine` right-distributivity. It's not immediately clear to me how to fix this, so I'm opening this up in case somebody else gets to it first.
removing from the 1.0.0-MF project since it's going to continue on #1714 |
Not sure how to repeat this bug. The following test passes on both mater and 0.9.0 val s = new StateT(None: Option[Int => Option[(Int, Int)]])
.handleErrorWith((_: Unit) => StateT.pure(0))
s.run(3) should === (Some((3, 0))) |
I'm pretty sure that this is resolved, so I'm going to close this out. @djspiewak please speak up if I'm mistaken. |
It seems like a more correct implementation would be the following:
Specifically, if the outer
F
in theStateT
israiseError
, it will not be handled.The text was updated successfully, but these errors were encountered: