-
-
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
Write documentation for ContT #2677
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2677 +/- ##
=======================================
Coverage 95.13% 95.13%
=======================================
Files 365 365
Lines 6757 6757
Branches 300 300
=======================================
Hits 6428 6428
Misses 329 329 Continue to review full report at Codecov.
|
Thanks so much, @cb372. Our users can certainly use some documentation on this one. I think this draft explained well how to use it. There are a couple of points that not obvious to me and possibly other readers with no experience with
def defer[M[_], A, B](b: => B): ContT[M, A, B] = apply(_(b)) I suspect that there must be reason but it's just not obvious to me, and probably worth documenting. |
I can’t think of a reason not to have that function. It should work just fine and it sounds quite useful. |
@kailuowang that fuction is hiding there. It is By hiding I mean you can use Defer and Applicative to make this function. It didn’t occur to me. Sorry. |
OK, I'll submit a separate PR to add that helper function. It does sounds useful. Once that's merged and released, we can update this documentation to use it. It's worth pointing out that the ContT.apply { hole =>
for {
a <- doFirstThing()
b <- doSecondThing(a)
c <- hole(b)
d <- doFourthThing(c)
} yield d
} (Gabriel Gonzalez goes into more detail in this blogpost.) As for your first question,
I don't really have a good answer to that. To be honest, I find the chain of Kleislis easier to follow and I struggled to come up with a motivating example for One (rather weak) argument is that |
One thing to note: foreach is a continuation, forall is a continuation, foldMap is a continuation, etc.... Many of our familiar functions take a |
Thanks @cb372. Yeah, the original |
I propose we get this merged first and we can address the method addition and document update in a separate PR. |
Had a crack at writing some documentation for ContT.
Corrections/suggestions welcome.