Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save VinceMacBuche/baa811846c4dca578b6e09458336af86 to your computer and use it in GitHub Desktop.
Save VinceMacBuche/baa811846c4dca578b6e09458336af86 to your computer and use it in GitHub Desktop.
small example for Pierre
val f: String => Int = (s => s.length)
val g : Int => String = (i => i.toString)
implicit class Pipe[A,B](f : A => B) {
def |>[C] (g : C => A) : C => B = f.compose(g)
}
implicit class Apply[A](a : A) {
def |>[B] (fun : A => B) : B = fun(a)
}
4 |> (f |> g)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment