Right-Associative Function Application

implicit class RightApply[A](x: A) {
  def :::[B](f: A => B): B = f(x)
}
val log: Any => Unit =
  x => println(s"${new java.util.Date} - ${x}")

log ::: 6 * 7

References

Demo

This file is literate Scala, and can be run using Codedown:

$ curl -s https://earldouglas.com/posts/scala-type-classes/rapply.md |
  codedown scala | xargs -0 scala -e
Fri Mar 08 09:43:38 MST 2019 - 42