From 138e65252dae2847221466d54f1f48e0f8a82a39 Mon Sep 17 00:00:00 2001 From: Zelenya Date: Sun, 10 Jun 2018 14:43:15 +0200 Subject: [PATCH 1/2] update bisequence doc on Bitraverse --- core/src/main/scala/cats/Bitraverse.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/scala/cats/Bitraverse.scala b/core/src/main/scala/cats/Bitraverse.scala index 7444ec64c5..19be9f017d 100644 --- a/core/src/main/scala/cats/Bitraverse.scala +++ b/core/src/main/scala/cats/Bitraverse.scala @@ -13,7 +13,7 @@ import simulacrum.typeclass def bitraverse[G[_]: Applicative, A, B, C, D](fab: F[A, B])(f: A => G[C], g: B => G[D]): G[F[C, D]] /** - * Sequence each side of the structure with the given functions. + * Invert the structure from F[G[A], G[B]] to G[F[A, B]]. * * Example: * {{{ From 339b1f786fa29d4433e4a6db90659249f1258c03 Mon Sep 17 00:00:00 2001 From: Zelenya Date: Sun, 10 Jun 2018 15:05:37 +0200 Subject: [PATCH 2/2] add bitraverse example --- core/src/main/scala/cats/Bitraverse.scala | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/core/src/main/scala/cats/Bitraverse.scala b/core/src/main/scala/cats/Bitraverse.scala index 19be9f017d..0d75d160f7 100644 --- a/core/src/main/scala/cats/Bitraverse.scala +++ b/core/src/main/scala/cats/Bitraverse.scala @@ -9,7 +9,22 @@ import simulacrum.typeclass */ @typeclass trait Bitraverse[F[_, _]] extends Bifoldable[F] with Bifunctor[F] { self => - /** Traverse each side of the structure with the given functions */ + /** + * Traverse each side of the structure with the given functions. + * + * Example: + * {{{ + * scala> import cats.implicits._ + * + * scala> def parseInt(s: String): Option[Int] = Either.catchOnly[NumberFormatException](s.toInt).toOption + * + * scala> ("1", "2").bitraverse(parseInt, parseInt) + * res0: Option[(Int, Int)] = Some((1,2)) + * + * scala> ("1", "two").bitraverse(parseInt, parseInt) + * res1: Option[(Int, Int)] = None + * }}} + */ def bitraverse[G[_]: Applicative, A, B, C, D](fab: F[A, B])(f: A => G[C], g: B => G[D]): G[F[C, D]] /**