From fd3242293b470da3bdb1172245d9be04c7cd6d5b Mon Sep 17 00:00:00 2001 From: Cody Allen Date: Tue, 16 Feb 2016 07:52:00 -0500 Subject: [PATCH] Delegate to Traverse.sequence in Applicative.sequence The previous approach duplicated the implementation of `sequence`, which is a slight code stink. More importantly though, this approach will benefit from an optimized override implementation of `sequence` if the `Traverse` instance has one. --- core/src/main/scala/cats/Applicative.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/scala/cats/Applicative.scala b/core/src/main/scala/cats/Applicative.scala index 70bdbf40d6..9f5642d53a 100644 --- a/core/src/main/scala/cats/Applicative.scala +++ b/core/src/main/scala/cats/Applicative.scala @@ -45,8 +45,8 @@ import simulacrum.typeclass def traverse[A, G[_], B](value: G[A])(f: A => F[B])(implicit G: Traverse[G]): F[G[B]] = G.traverse(value)(f)(this) - def sequence[G[_]: Traverse, A](as: G[F[A]]): F[G[A]] = - traverse(as)(a => a) + def sequence[G[_], A](as: G[F[A]])(implicit G: Traverse[G]): F[G[A]] = + G.sequence(as)(this) }