Skip to content

Add Functor#composeBifunctor#4434

Merged
armanbilge merged 1 commit intotypelevel:mainfrom
armanbilge:topic/functor-compose-bifunctor
May 7, 2023
Merged

Add Functor#composeBifunctor#4434
armanbilge merged 1 commit intotypelevel:mainfrom
armanbilge:topic/functor-compose-bifunctor

Conversation

@armanbilge
Copy link
Copy Markdown
Member

This PR proposes a different encoding of #4362 (note, which is not yet released). /cc @bpholt

Specifically, Cats has a precedent of offering various compose methods for creating nested instances, but I'm not sure if there is much precedent for offering these instances as implicits. Furthermore as noted in #4362 inference does not work very well for this implicit anyway.

So I think replacing the implicit with a composeBifunctor method may yield better and more consistent ergonomics i.e. Instead of:

Bifunctor[λ[(A, B) => F[(A, B)]]].leftMap(fab)(f)

now you would write:

Functor[F].composeBifunctor[(*, *)].leftMap(fab)(f)
// or
F.composeBifunctor[(*, *)].leftMap(fab)(f)

Thoughts?

@bpholt
Copy link
Copy Markdown
Member

bpholt commented May 5, 2023

This seems pretty reasonable to me!

@armanbilge armanbilge merged commit d5f7d63 into typelevel:main May 7, 2023
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