Skip to content

Instantly share code, notes, and snippets.

@sadache
Created August 10, 2010 15:05
Show Gist options
  • Save sadache/517419 to your computer and use it in GitHub Desktop.
Save sadache/517419 to your computer and use it in GitHub Desktop.
case class Error(msg:String)
val one:Either[Int,Error]= Left(1)
val two:Either[Int,Error]= Right(Error("oops"))
val result=for(a<-one.left; t <- two.left) yield a + t
// defined class Error
// one: Either[Int,Error] = Left(1)
// two: Either[Int,Error] = Right(Error(oops))
// result: Either[Int,Error] = Right(Error(oops))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment