Skip to content

Instantly share code, notes, and snippets.

@gvolpe
Created March 2, 2019 02:03
Show Gist options
  • Save gvolpe/acf62ba1a15460579a60366d36f00d11 to your computer and use it in GitHub Desktop.
Save gvolpe/acf62ba1a15460579a60366d36f00d11 to your computer and use it in GitHub Desktop.
// (.) :: (b -> c) -> (a -> b) -> a -> c
implicit class FancyComposition[A, B, C](f: B => C) {
def `.`(g: A => B): A => C = f.compose(g)
}
val f: Int => String = _.toString
val g: String => Boolean = _.contains("1")
val h: Int => Boolean = g `.` f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment