We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'll just leave this here..
/** Laws? */ trait SumElim[F[_, _], G[_], A] { def elim[B, C](f: F[A, B])(left: A => C, right: B => C): G[C] } object SumElim { implicit def either[A]: SumElim[Either, Id, A] = new SumElim[Either, Id, A] { def elim[B, C](f: Either[A, B])(left: A => C, right: B => C): C = f.fold(left, right) } implicit def disjunction[A]: SumElim[Disjunction, Id, A] = new SumElim[Disjunction, Id, A] { def elim[B, C](f: Disjunction[A, B])(left: A => C, right: B => C): C = f.fold(left, right) } implicit def disjunctionT[G[_] : Functor, A]: SumElim[DisjunctionT[G, ?, ?], G, A] = new SumElim[DisjunctionT[G, ?, ?], G, A] { def elim[B, C](f: DisjunctionT[G, A, B])(left: A => C, right: B => C): G[C] = f.fold(left, right) } implicit val future: SumElim[({type l[e, a] = Future[a]})#l, Future, Throwable] = new SumElim[({type l[e, a] = Future[a]})#l, Future, Throwable] { def elim[B, C](f: Future[B])(left: Throwable => C, right: B => C): Future[C] = f.map(right).recover(left) } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I'll just leave this here..
The text was updated successfully, but these errors were encountered: