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

Adding MonadRec for Kleisli #1279

Closed
wants to merge 3 commits into from

Conversation

zainab-ali
Copy link
Contributor

Adding a MonadRec instance for Kleisli

@codecov-io
Copy link

codecov-io commented Aug 10, 2016

Current coverage is 90.56% (diff: 100%)

Merging #1279 into master will decrease coverage by <.01%

@@             master      #1279   diff @@
==========================================
  Files           243        243          
  Lines          3285       3295    +10   
  Methods        3228       3236     +8   
  Messages          0          0          
  Branches         55         56     +1   
==========================================
+ Hits           2975       2984     +9   
- Misses          310        311     +1   
  Partials          0          0          

Sunburst

Powered by Codecov. Last update 97fc762...c3f1cae


def local[B](f: A => A)(fa: Kleisli[F, A, B]): Kleisli[F, A, B] =
Kleisli(f.andThen(fa.run))
implicit def catsDataMonadRecForKleisli[F[_], A](implicit ev0: Monad[F], ev1: MonadRec[F]): MonadRec[Kleisli[F, A, ?]] =
Copy link
Contributor

@kailuowang kailuowang Aug 10, 2016

Choose a reason for hiding this comment

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

I am curious why we need evidences for both Monad[F] and MonadRec[F], since MonadRec[F] extends Monad?

Copy link
Contributor

Choose a reason for hiding this comment

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

Should only need MonadRec[F] since that implies Monad[F]. And for single implicit parameters I believe the Cats style is:

catsDataMonadRecForKleisli[F[_], A](implicit F: Monad[F]): MonadRec[Kleisli[F, A, ?]] = ...

@kailuowang
Copy link
Contributor

it might be worthwhile to wait on #1280

@johnynek
Copy link
Contributor

@zainab-ali could you review #1280 and see if you think I have correctly implemented this there? I did add tests (and stack safety tests).

@kailuowang
Copy link
Contributor

@zainab-ali shall we close this one given that #1280 is merged?

@johnynek
Copy link
Contributor

closing since #1280 is merged. Reopen if this incorrect. Thanks for the contribution (which helped #1280).

@johnynek johnynek closed this Aug 16, 2016
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.

5 participants