Skip to content

Instantly share code, notes, and snippets.

@KirinDave
Created February 11, 2011 20:49
Show Gist options
  • Select an option

  • Save KirinDave/823000 to your computer and use it in GitHub Desktop.

Select an option

Save KirinDave/823000 to your computer and use it in GitHub Desktop.
begin0 for scala
package com.banksimple.util
private[util] final class Also[T](val origin: T) {
def andAlso(x: T => Unit): T = { x(origin) ; origin }
def andThen(x: => Unit): T = { x ; origin }
}
object Also {
implicit def thing2Also[T](x: T): Also[T] = new Also(x)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment