-
-
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 instance for Kleisli #1543
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1543 +/- ##
==========================================
+ Coverage 92.48% 92.48% +<.01%
==========================================
Files 246 246
Lines 3885 3886 +1
Branches 133 132 -1
==========================================
+ Hits 3593 3594 +1
Misses 292 292
Continue to review full report at Codecov.
|
|
I'm not aware of such a rule (and if there is one, it is already broken by |
@durban, you are right, I believe
|
|
||
def tailRecM[B, C](b: B)(f: B => Kleisli[F, A, Either[B, C]]): Kleisli[F, A, C] = | ||
Kleisli[F, A, C]({ a => FlatMap[F].tailRecM(b) { f(_).run(a) } }) | ||
} |
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.
Like this we have the same code twice:
- here in
KleisliFlatMap
- and in
catsDataMonadReaderForKleisli
Maybe we could create a KleisliMonad
which can be extended by a KleisliMonadReader
and a KleisliMonadError
(similar as how it is done in StateT
) ?
@kailuowang @peterneyens I've amended my commit to address your comments. (I've also rebased to the current master.) |
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.
LGTM, thanks very much!
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 the changes!
Fixes #1542.