Advertisement
Guest User

Untitled

a guest
May 24th, 2015
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.65 KB | None | 0 0
  1. object Example
  2.   def foo(x: Int): Either[Exception, Int] = ... etc
  3.   def bar(x: Int): Either[Exception, Int] = ... etc
  4.   def baz(x: Int): Either[Exception, Int] = ... etc
  5.   def qux(x: Int): Either[Exception, Int] = ... etc
  6.   ...etc
  7.  
  8.   def main(args: Array[String]): Unit = {
  9.  
  10.     val x = foo(1) match {
  11.       case Right(x) => x
  12.       case Left(e) => return
  13.     }
  14.  
  15.     val y = bar(x) match {
  16.       case Right(y) => y
  17.       case Left(e) => return
  18.     }
  19.  
  20.     val z = baz(y) match {
  21.       case Right(z) => z
  22.       case Left(e) => return
  23.     }
  24.  
  25.     val a = foo(z) match {
  26.       case Right(a) => a
  27.       case Left(e) => return
  28.     }
  29.  
  30.     ...etc
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement