-
-
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
Put liftT on the companion object of XorT #1215
Conversation
Current coverage is 89.27% (diff: 100%)@@ master #1215 diff @@
==========================================
Files 234 234
Lines 3144 3161 +17
Methods 3085 3104 +19
Messages 0 0
Branches 57 54 -3
==========================================
+ Hits 2804 2822 +18
+ Misses 340 339 -1
Partials 0 0
|
@zmccoy thanks! This looks good. Only one minor suggestion: to be consistent with other functions, could you add this to the |
I think We also have the syntax 1.some.rightXorT[String]
// XorT[Option,String,Int] = XorT(Some(Right(1)))
XorT.right[Option, String, Int](1.some)
// XorT[Option,String,Int] = XorT(Some(Right(1))) It is a good idea to use |
@peterneyens ah good point. I had forgotten about that. If a |
@peterneyens I somehow completely missed that when I skimmed the source! |
I've put the function in the correct place, added it as an alias to |
/** | ||
* Alias for XorT.right | ||
*/ | ||
final def liftT[F[_], A, B](fb: F[B])(implicit F: Functor[F]): XorT[F, A, B] = right(fb) |
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.
why do we even need Functor
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.
Without the implicit evidence for a Functor
it won't compile since right
needs one.
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.
Indeed. I made the mistake of believing that was just Xor.right
Sorry for the noise.
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.
All good, I'm just happy I could answer :)
/** | ||
* Alias for [[XorT.right]] | ||
*/ | ||
final def liftT[F[_], A, B](fb: F[B]): XorT[F, A, B] = right(fb) |
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 currently isn't compiling, because it needs an F[_]: Functor
constraint here for the call to right
.
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.
That was my bad, I pushed up a bad commit with the scaladoc link in it. I ended up in a hurry and my laptop was dieing. I'll get that all fixed along with the sbt-doctest later this evening / tomorrow
@ceedubs I'm not very familiar with sbt-doctest but I think that's what you were looking for, but if it isn't I'd love to fix it up. Let me know if you need anything else. |
* Alias for [[XorT.right]] | ||
* {{{ | ||
* scala> import cats.data.XorT | ||
* scala> import cats.instances.option._ |
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.
Could you please use import cats.implicits._
here? See #1026 for justification.
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.
Totally, thanks for the link.
👍 thanks! |
Hi @ceedubs is there anything else I need to do on this for review? :) |
👍 Thanks very much! |
I found it useful to have liftT available to me for wrapping values in XorT. I couldn't figure out what test should be added in this case, but if anyone has any examples or suggestions I'd love to add one.