-
-
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.fromFunction, WriterT.liftFunctionK #3644
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.
LGTM!
* res0: Option[String] = Some(42) | ||
* }}} | ||
*/ | ||
def fromFunction[M[_]: Applicative, A, R](f: R => A): Kleisli[M, R, A] = |
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.
Is this a candidate for some partial application tomfoolery so we might be able to say Kleisli.fromFunction[Option]
and infer the R
and A
?
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.
it's a good idea, I will give it a closer look
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 guess we can't infer R anyway unless there's a type annotation for the whole thing. Probably the best we can do is Kleisli.fromFunction[Option, Int]
and inferring the result.
@rossabaker when you have time, I'd appreciate another look :) |
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 like it. 👍
No description provided.