Esempio n. 1
0
 public static Either <A, B> Right <A, B>(this B b) => Either <A, B> .Right(b);
Esempio n. 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)));
Esempio n. 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));
Esempio n. 4
0
 public static Either <A, B> Left <A, B>(this A a) => Either <A, B> .Left(a);
Esempio n. 5
0
 public static Either <X, A> Flatten <X, A>(this Either <X, Either <X, A> > o) => o.SelectMany(z => z);
Esempio n. 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)));
Esempio n. 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)));
Esempio n. 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);
Esempio n. 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)));