-
-
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
Functor composition. #165
Functor composition. #165
Conversation
…tandardize to Lambda in the file.
This is to fix #148. |
new CompositeApply[F,G] { | ||
implicit def F: Apply[F] = self | ||
implicit def G: Apply[G] = GG | ||
def compose[G[_]: Apply]: Apply[Lambda[X => F[G[X]]]] = |
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.
In #27 it sounds like the agreed upon convention (that we still need to add to the contributor guide) is to use the implicit GG: Apply[G]
approach instead of using G[_]: Apply
and then calling Apply[G]
. Could you please change this back to the previous form? The change from type lambda to Lambda
is good - keep that change.
Could you also do the same change in the other places in this diff where <Typeclass>.apply
is being called to fetch the implicit?
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.
Sure thing! Thanks for looking at it!
Thanks! Travis is complaining about some trailing whitespace in Functor.scala. Other than this and my one inline comment I think this is good, but I haven't yet looked at it in detail. |
|
||
/** | ||
* Compose this functor F with a Contravariant Functor G to produce a new Contravariant Functor | ||
* on G[F[_]]. |
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.
F[G[_]]
?
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.
You're right. Fixed.
…pply method on the companion object.
Travis was happy, but then I removed my change to InvariantLaws because it wasn't suppose to be there. Everything should be good and all questions above have been addressed. |
Seems good. 👍 |
👍 |
@coltfred sorry, but could you please sync this with master? After that I think it will be good to merge. |
Conflicts: core/src/main/scala/cats/Apply.scala
@ceedubs I merged master into this PR. |
@coltfred thanks! 👍 |
I've ported the code from @mpilquist's Structure with some slight modifications. I didn't write additional tests and decided it'd be more valuable to open the PR rather than waiting to hear back in chat about the correct way to add this kind of thing to the test suite.
I'm not sure given the correct types that it's possible to write the compositions incorrectly, but it might be a good idea to express that in some laws.