-
-
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
Add Kleisli#mapK equivalent returning FunctionK #2450
Conversation
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 PR. I'm not crazy about mapKK as a name. Also, I'd like to exercise all code in a test. basically that this behaves the same as calling mapK on the instance should a good test.
Sure, I wanted to get some initial feedback before taking the time to write (a) test(s) :) as mentioned in the issue, I'd gladly rename it too, but |
This |
I would start by defining this for Kleisli for now, and if we see this used by people enough to make an abstraction, maybe then we'll add a typeclass? ( |
I am ok with adding it to Kleisli first under the name liftK or liftNT |
There's already a |
The def lift[A, B](f: A => B): F[A] => F[B] =
fa => map(fa)(f) I think |
That makes sense, yeah. I think `liftNT` will be good enough then :)
…On Sat, Oct 6, 2018, 02:18 Kai(luo) Wang ***@***.***> wrote:
The lift method in Functor is the inspiration of this name.
def lift[A, B](f: A => B): F[A] => F[B] =
fa => map(fa)(f)
I think liftNT or liftFunctionK is fine since it's about lifting a
FunctionK to another FunctionK to the Kleisli space. lift is an general
action, to be honest, I don't see much confusion if you have lift that
lifts a F[B] or B to a Kleisli, and liftNT that lifts a FunctionK of F, G
to another FunctionK of Kleisli[F] and Kleisli[G]
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#2450 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AA2npAOZS0tFhXQqvdXk--qLg59UmQY0ks5uh_a9gaJpZM4WV6lg>
.
|
Renamed to |
Apparently the addition isn't binary compatible, but only on 2.11. Any ideas, @kailuowang? |
Make a new trait |
Codecov Report
@@ Coverage Diff @@
## master #2450 +/- ##
==========================================
+ Coverage 95.12% 95.12% +<.01%
==========================================
Files 363 363
Lines 6704 6705 +1
Branches 289 284 -5
==========================================
+ Hits 6377 6378 +1
Misses 327 327
Continue to review full report at Codecov.
|
hmm, now I see that you mentioned Edit: no, it won't |
@LukaJCB hi, is there anything else I need to do with this one? |
@@ -111,21 +110,21 @@ object Kleisli extends KleisliInstances with KleisliFunctions with KleisliExplic | |||
} | |||
} | |||
|
|||
sealed private[data] trait KleisliFunctions { | |||
private[data] sealed trait KleisliFunctions { |
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.
Was this done for a particular reason? :)
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.
no, just a rebase issue - I'll revert
* scala> b.value.run("").value | ||
* res0: Option[Int] = Some(1) | ||
* }}} | ||
*/ |
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.
This is IntelliJ autoformating, I assume?
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.
ugh. For some reason it didn't enable scalafmt in cats, it seems...
Sorry @kubukoz, it looks good, just a couple of nitpicks :) |
@kubukoz build failed due to scalafmt check, would you run |
Done :) |
@kailuowang WDYT about merging this? |
@kubukoz sorry I dropped the ball on this one. And after another look, I am not sure about the |
It's okay, I know how important it is to get the API right when you can't rename it for a while :) We can definitely rename, and although I like shorter names I'll say |
Thanks! |
Fix typo Remove whitespace Rename mapKK to liftNT, add test, add scaladoc Fix doctests Move `liftNT` to bincompat trait Extend bincompat trait in `Kleisli`'s companion object Remove rebase remainder
I think you renamed the wrong function :P |
Yeah, just noticed. Time does things to people... |
(Rerunning due to the neverending Travis build on 2.13) |
Related: typelevel/cats-effect#334
I don't like the name either, so feel free to suggest a better one 😅