Created
July 8, 2011 21:58
-
-
Save nuttycom/1072932 to your computer and use it in GitHub Desktop.
Thrush combinator using partial function => Option
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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