Skip to content

Instantly share code, notes, and snippets.

@nuttycom
Created July 8, 2011 21:58
Show Gist options
  • Save nuttycom/1072932 to your computer and use it in GitHub Desktop.
Save nuttycom/1072932 to your computer and use it in GitHub Desktop.
Thrush combinator using partial function => Option
implicit def pf[A](a: A): PF[A] = new PF(a)
class PF[A](a: A) {
def option[B](pf: PartialFunction[A, B]): Option[B] = pf.lift.apply(a)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment