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 more doctests to Kleisli #2722

Merged
merged 4 commits into from
Feb 8, 2019
Merged

Conversation

nasadorian
Copy link
Contributor

Re: Issue #2479 -- Appreciate any feedback to improve or further clarify examples.

Adds comments and some doctests for Kleisli:

  • dimap
  • map
  • andThen
  • local
  • liftF
  • pure
  • ask

@codecov-io
Copy link

codecov-io commented Feb 3, 2019

Codecov Report

Merging #2722 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2722   +/-   ##
=======================================
  Coverage   95.13%   95.13%           
=======================================
  Files         365      365           
  Lines        6798     6798           
  Branches      296      313   +17     
=======================================
  Hits         6467     6467           
  Misses        331      331
Impacted Files Coverage Δ
core/src/main/scala/cats/data/Kleisli.scala 97.29% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 356e339...b22a1a4. Read the comment docs.

Copy link
Contributor

@ceedubs ceedubs left a comment

Choose a reason for hiding this comment

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

Thanks, @nasadorian! Good stuff.

I left one minor comment. Also the git history is a little messy and seems to have some commits with duplicate titles. It may be a bit cleaner to squash some of those, but it's no big deal either way.

def pure[F[_], A, B](x: B)(implicit F: Applicative[F]): Kleisli[F, A, B] =
Kleisli(_ => F.pure(x))

/**
* Similar to [[pure]] except the input type is the same as the `A` in output type `F[A]`.
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment is true, but I think that it could be more illustrative. In my mind, ask is to Kleisli as identity is to Function1. I think that it would be helpful to point out that in the resulting Kleisli, the output A is the same as the input A (the actual value not just the type). A code example might help get this point across.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just updated and added an example to ask

@nasadorian
Copy link
Contributor Author

Thanks, @nasadorian! Good stuff.

I left one minor comment. Also the git history is a little messy and seems to have some commits with duplicate titles. It may be a bit cleaner to squash some of those, but it's no big deal either way.

Thanks for the review @ceedubs - yes I think I'll squash the commits into one.

kailuowang
kailuowang previously approved these changes Feb 5, 2019
Copy link
Contributor

@kailuowang kailuowang left a comment

Choose a reason for hiding this comment

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

LGTM, thanks very much!

@nasadorian
Copy link
Contributor Author

Okay @kailuowang I got the build to pass, looks like my commits overrode your approval 😅

Copy link
Contributor

@ceedubs ceedubs left a comment

Choose a reason for hiding this comment

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

🎉 thanks, @nasadorian!

@ceedubs ceedubs merged commit 7ade01a into typelevel:master Feb 8, 2019
@kailuowang kailuowang added this to the 2.0.0-M1 milestone Apr 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants