Example #1
0
 public static Either <A, B> Right <A, B>(this B b) => Either <A, B> .Right(b);
Example #2
0
 public Either <A, D> ZipWith <C, D>(Either <A, C> o, Func <B, Func <C, D> > f) =>
 this.SelectMany(a => o.Select(b => f(a)(b)));
Example #3
0
 public static Pair <Either <X, A>, Either <X, B> > Unzip <X, A, B>(this Either <X, Pair <A, B> > p) => p.Select(q => q._1.Get).And(p.Select(q => q._2.Get));
Example #4
0
 public static Either <A, B> Left <A, B>(this A a) => Either <A, B> .Left(a);
Example #5
0
 public static Either <X, A> Flatten <X, A>(this Either <X, Either <X, A> > o) => o.SelectMany(z => z);
Example #6
0
 public static Either <X, B> Apply <X, A, B>(this Either <X, Func <A, B> > f, Either <X, A> o) =>
 f.SelectMany(g => o.Select(p => g(p)));
Example #7
0
 public static Either <X, C> SelectMany <X, A, B, C>(this Either <X, A> k, Func <A, Either <X, B> > p, Func <A, B, C> f) =>
 SelectMany(k, a => Select(p(a), b => f(a, b)));
Example #8
0
 public static Either <X, B> SelectMany <X, A, B>(this Either <X, A> k, Func <A, Either <X, B> > f) =>
 k.Fold(x => Either <X, B> .Left(x), f);
Example #9
0
 public static Either <X, B> Select <X, A, B>(this Either <X, A> k, Func <A, B> f) =>
 k.Fold(x => Either <X, B> .Left(x), a => Either <X, B> .Right(f(a)));