-
-
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
Implement Reducible.reduceM #1193
Conversation
@@ -60,6 +60,12 @@ import simulacrum.typeclass | |||
def reduceLeftTo[A, B](fa: F[A])(f: A => B)(g: (B, A) => B): B | |||
|
|||
/** | |||
* Monadic variant of `reduceLeftTo` | |||
* */ |
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.
Minor nitpicks:
Could we change the last line of the scaladoc entry to just */
?
Also can we use [[reduceLeftTo]]
so that the scaladoc has a handy link?
Thanks @benhutchison! It looks good -- I just left a few very minor formatting/stylistic thoughts. I also wonder about using the name |
Current coverage is 89.16%@@ master #1193 diff @@
==========================================
Files 234 234
Lines 3137 3139 +2
Methods 3083 3083
Messages 0 0
Branches 52 53 +1
==========================================
+ Hits 2797 2799 +2
Misses 340 340
Partials 0 0
|
e089220
to
93ae316
Compare
👍 looks good to me once the build passes. |
@@ -60,6 +60,12 @@ import simulacrum.typeclass | |||
def reduceLeftTo[A, B](fa: F[A])(f: A => B)(g: (B, A) => B): B | |||
|
|||
/** | |||
* Monadic variant of [[reduceLeftTo]] | |||
*/ | |||
def reduceLeftM[G[_], A, B](fa: F[A])(f: A => G[B])(g: (B, A) => G[B])(implicit G: Monad[G]): G[B] = |
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.
I think we can change Monad
to FlatMap
here.
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.
And since another change has been suggested I feel less guilty about this one: can you shift the asterisks one space to the left to be javadoc style like other comments in the file? :)
I left one minor comment, for the rest 👍 |
93ae316
to
1b954ed
Compare
Nice work, @benhutchison! |
foldM
for nonempty collections. First mention: https://gitter.im/typelevel/cats?at=5781d3f33eaf66535e62da69