Skip to content
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

Merged
merged 3 commits into from
Nov 8, 2020
Merged

Add Kleisli.fromFunction, WriterT.liftFunctionK #3644

merged 3 commits into from
Nov 8, 2020

Conversation

kubukoz
Copy link
Member

@kubukoz kubukoz commented Oct 21, 2020

No description provided.

LukaJCB
LukaJCB previously approved these changes Oct 21, 2020
Copy link
Member

@LukaJCB LukaJCB left a 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] =
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member Author

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.

@kubukoz
Copy link
Member Author

kubukoz commented Nov 5, 2020

@rossabaker when you have time, I'd appreciate another look :)

Copy link
Member

@rossabaker rossabaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it. 👍

@rossabaker rossabaker merged commit 693e583 into typelevel:master Nov 8, 2020
@kubukoz kubukoz deleted the maptransformer branch January 5, 2021 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants