From fb6045688652df7d35f03d17eb8d414c3423aa5e Mon Sep 17 00:00:00 2001 From: Raymond Tay Date: Sat, 7 Oct 2017 12:26:41 +0800 Subject: [PATCH] Example for beginners to use Arrow composition --- core/src/main/scala/cats/arrow/Compose.scala | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/src/main/scala/cats/arrow/Compose.scala b/core/src/main/scala/cats/arrow/Compose.scala index d5157f24eb..783c2a37d7 100644 --- a/core/src/main/scala/cats/arrow/Compose.scala +++ b/core/src/main/scala/cats/arrow/Compose.scala @@ -8,6 +8,19 @@ import simulacrum.typeclass */ @typeclass trait Compose[F[_, _]] { self => + /** + * Here's how you can use `>>>` and `<<<` + * Example: + * {{{ + * scala> import cats.implicits._ + * scala> import cats.arrow._ + * scala> val f = (_ + 1) + * scala> val g = (_ * 100) + * scala> (f >>> g)(3) + * res0: Int = 400 + * scala> (f <<< g)(3) + * res1: Int = 301 + * }}} @simulacrum.op("<<<", alias = true) def compose[A, B, C](f: F[B, C], g: F[A, B]): F[A, C]