Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** The coproduct of two functors annihilates their product. */
- implicit def coproductProductZap[F[_], FF[_], G[_], GG[_]](implicit d1: Zap[FF, F], d2: Zap[GG, G]):
- Zap[({ type λ[α] = (FF[α], GG[α]) })#λ, ({ type λ[α] = (F[α] \/ G[α]) })#λ] =
- new Zap[({ type λ[α] = (FF[α], GG[α]) })#λ, ({ type λ[α] = (F[α] \/ G[α]) })#λ] {
- def zapWith[A, B, C](a: (FF[A], GG[A]), b: (F[B] \/ G[B]))(f: (A, B) => C) =
- b match {
- case -\/(fb) => d1.zapWith(a._1, fb)(f)
- case \/-(gb) => d2.zapWith(a._2, gb)(f)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement