From 7b6e3563c5536dcb02d875b942c65f53fb63a66b Mon Sep 17 00:00:00 2001 From: peterneyens Date: Tue, 18 Oct 2016 14:31:30 +0200 Subject: [PATCH] Simplify FunctionK.or by using Coproduct.fold. --- core/src/main/scala/cats/arrow/FunctionK.scala | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/core/src/main/scala/cats/arrow/FunctionK.scala b/core/src/main/scala/cats/arrow/FunctionK.scala index 2ef278eb39..a9987ef79f 100644 --- a/core/src/main/scala/cats/arrow/FunctionK.scala +++ b/core/src/main/scala/cats/arrow/FunctionK.scala @@ -47,10 +47,7 @@ trait FunctionK[F[_], G[_]] extends Serializable { self => */ def or[H[_]](h: FunctionK[H, G]): FunctionK[Coproduct[F, H, ?], G] = new FunctionK[Coproduct[F, H, ?], G] { - def apply[A](fa: Coproduct[F, H, A]): G[A] = fa.run match { - case Left(ff) => self(ff) - case Right(gg) => h(gg) - } + def apply[A](fa: Coproduct[F, H, A]): G[A] = fa.fold(self, h) } }