-
-
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
Expose FunctionK.liftFunction as a part of the Scala 3 API #4600
Expose FunctionK.liftFunction as a part of the Scala 3 API #4600
Conversation
cf011ea
to
237a489
Compare
237a489
to
baec5e0
Compare
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'm onboard with this, it will help cross compiling.
test("lift a function directly using Scala 2 compatible syntax") { | ||
def headOption[A](list: List[A]): Option[A] = list.headOption | ||
val fHeadOption = FunctionK.liftFunction[List, Option](headOption) | ||
forAll { (a: List[Int]) => | ||
assert(fHeadOption(a) === a.headOption) | ||
} | ||
} |
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.
Just to note: I feel this test case should be extracted into a new test suite that would cross-compile for both Scala2 and Scala3. Looks like there's no such test suite available for FunctionK
. We can do it in a separate follow up PR though.
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.
Ooh that's a good idea
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.
Thank you for the PR!
This PR adds liftFunction into the Scala 3 API.
That would help us to remove FunctionKLift from cats-tagless and from a couple of other libraries. Right now I'm just borrowing this file around :D
Closes #4449
cc @joroKr21