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 sum: (F[A], F[B]) => F[A Either B] #3112

Closed
Krever opened this issue Oct 13, 2019 · 1 comment · Fixed by #3124
Closed

Add sum: (F[A], F[B]) => F[A Either B] #3112

Krever opened this issue Oct 13, 2019 · 1 comment · Fixed by #3124

Comments

@Krever
Copy link

Krever commented Oct 13, 2019

Hey, I have

type X[T] = Kleisli[OptionT[F, *], Foo, T]

and would like to go from (X[A], X[B]) to X[Either[A, B]].

So similar to what <+> does (e.g. in http4s) but on two different types joined by Either. Right now I map and use <+> afterwards.

Signature proposed by @LukaJCB :

def sum[F[_]: SemigroupK, Functor, A, B](fa: F[A], fb: F[B]): F[A Either B]
@pk044
Copy link
Contributor

pk044 commented Oct 23, 2019

i'd be happy to give it a try :)

pk044 added a commit to pk044/cats that referenced this issue Nov 4, 2019
pk044 added a commit to pk044/cats that referenced this issue Nov 4, 2019
LukaJCB pushed a commit that referenced this issue Nov 5, 2019
* #3112 adding implementation

* #3112 added documentation with example

* adding pk044 to AUTHORS.md

* formatting

* fixed doctest

* fixed doctest

* used different type in example
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 a pull request may close this issue.

2 participants