-
-
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
StateT no longer violates laws #1735
Conversation
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.
Thanks @djspiewak! I was feeling very uneasy about this. It seems like it would be nice to have a |
Codecov Report
@@ Coverage Diff @@
## master #1735 +/- ##
==========================================
- Coverage 94.03% 94.01% -0.03%
==========================================
Files 252 252
Lines 4189 4175 -14
Branches 154 154
==========================================
- Hits 3939 3925 -14
Misses 250 250
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for delving this through @djspiewak
Merging with two sign-offs. |
Closes #1714
Fixes the issues uncovered by @ceedubs. After a fair bit of digging, I'm relatively confident that the issues in question are stemming from the inconsistencies (but not unlawfulness) of deriving
Applicative
instances from nested type constructors (inconsistent relative to analogous monadic derivation). My arguments on #1714 were overbroad and unsupported, and further digging showed that they don't hold in general (which is good!).So I think we're good with
StateT
in its current formulation. At least, in so far as I can tell. The tests are now passing. This does break the API though, since certain functions are removed fromStateT
and now once again only available implicitly.