Skip to content

Instantly share code, notes, and snippets.

@ogatatsu
Created November 21, 2011 11:29
Show Gist options
  • Save ogatatsu/1382370 to your computer and use it in GitHub Desktop.
Save ogatatsu/1382370 to your computer and use it in GitHub Desktop.
RichEither
class RichEither[A](e: Either[Throwable, A]) {
def success: A = e match {
case Right(r) => r
case Left(l) => throw l
}
}
implicit def eitherWrapper[A](e: Either[Throwable, A]) = new RichEither(e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment