Skip to content

Commit

Permalink
Added examples of Arrow composition (#1952)
Browse files Browse the repository at this point in the history
* Example for beginners to use Arrow composition

* Example for beginners to use Arrow composition

* Got rid of whitespace at EOL

* Added type signatures

* Got rid of the unused import that is borking the build
  • Loading branch information
raymondtay authored and kailuowang committed Oct 10, 2017
1 parent 5f19814 commit 8e54a08
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 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,19 @@ import simulacrum.typeclass
*/
@typeclass trait Compose[F[_, _]] { self =>

/**
* Here's how you can use `>>>` and `<<<`
* Example:
* {{{
* scala> import cats.implicits._
* scala> val f : Int => Int = (_ + 1)
* scala> val g : Int => Int = (_ * 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]

Expand Down

0 comments on commit 8e54a08

Please sign in to comment.