Skip to content

Instantly share code, notes, and snippets.

@ogatatsu
Created December 13, 2011 17:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ogatatsu/1472936 to your computer and use it in GitHub Desktop.
Save ogatatsu/1472936 to your computer and use it in GitHub Desktop.
joinRightサンプル
scala> val a: Either[Exception, Either[Exception, Int]] = Right(Right(10))
a: Either[Exception,Either[Exception,Int]] = Right(Right(10))
scala> a.joinRight
res0: Either[Exception,Int] = Right(10)
scala> val b: Either[Exception, Either[Exception, Int]] = Right(Left(new Exception("a")))
b: Either[Exception,Either[Exception,Int]] = Right(Left(java.lang.Exception: a))
scala> b.joinRight
res1: Either[Exception,Int] = Left(java.lang.Exception: a)
scala> val c: Either[Exception, Either[Exception, Int]] = Left(new Exception("a"))
c: Either[Exception,Either[Exception,Int]] = Left(java.lang.Exception: a)
scala> c.joinRight
res2: Either[Exception,Int] = Left(java.lang.Exception: a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment