예제 #1
0
 @Override
 public <A> Either<S, A> mplus(_<__.µ<Either.µ, S>, A> one, _<__.µ<Either.µ, S>, A> two) {
     Either<S,A> first = Either.narrow(one);
     Either<S,A> second = Either.narrow(two);
     if (first.isLeft()) {
         return second.isRight() ? second :  Either.newLeft(monoid.apply(first.getLeft(), second.getLeft()));
     } else {
         return second.isLeft() || bias == Bias.FIRST_RIGHT ? first : second;
     }
 }
예제 #2
0
 @Override
 public <A> Either<S, A> mzero() {
     return Either.newLeft(monoid.identity());
 }