Skip to content

Instantly share code, notes, and snippets.

@NikitaMelnikov
Created November 13, 2017 10:57
Show Gist options
  • Save NikitaMelnikov/efda079451203ed27e0fcf219b27c686 to your computer and use it in GitHub Desktop.
Save NikitaMelnikov/efda079451203ed27e0fcf219b27c686 to your computer and use it in GitHub Desktop.
def doubleSay(what: String): String = s"$what $what"
def capitalize(what: String): String = what.capitalize
def exclaim(what: String): String = s"$what!"
implicit class PipeOps[A](a: A) {
def |>[B] (f: A => B): B = f(a)
}
"hello" |> doubleSay |> capitalize |> exclaim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment