Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added examples of Arrow composition #1952

Merged
merged 9 commits into from
Oct 10, 2017
14 changes: 14 additions & 0 deletions core/src/main/scala/cats/arrow/Compose.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ 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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the above two lines don't compile

/home/travis/build/typelevel/cats/core/.jvm/target/scala-2.10/src_managed/test/cats/arrow/ComposeDoctest.scala:20: missing parameter type for expanded function

* 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]

Expand Down