, . Either - , , Either. , Right Left , . adelbertc, scalaz Validation, .
POLA , :
def foo(): Either[Int, Int] = Right(1)
def bar(j: Int): Either[Int, Int] = Left(1)
def baz(z: Int): Either[Int, Int] = Right(3)
// Result is Left(1)
for (a <- foo().right; b <- bar(a).right; c <- baz(b).right) yield c
, .right for. Left(1) in bar - , , , Either Right -biased. .right :
for (a <- foo(); b <- bar(a); c <- baz(b)) yield c
Either , " ", (1) , , (2), Left(1) , , baz.
Validation, Either .