Ejemplo n.º 1
0
 public Ret Fail(Func <FAIL, Ret> fail) =>
 validation.Match(success, fail);
Ejemplo n.º 2
0
 public Unit Left(Action <FAIL> fail) =>
 validation.Match(success, fail);
Ejemplo n.º 3
0
 public static Lst <Validation <Fail, B> > Traverse <Fail, A, B>(this Validation <Fail, Lst <A> > ma, Func <A, B> f) =>
 ma.Match(
     Fail: ex => List(Validation <Fail, B> .Fail(ex)),
     Succ: xs => xs.Map(x => Success <Fail, B>(f(x))));
Ejemplo n.º 4
0
 public static Lst <Validation <MonoidFail, Fail, B> > Traverse <MonoidFail, Fail, A, B>(this Validation <MonoidFail, Fail, Lst <A> > ma, Func <A, B> f)
     where MonoidFail : struct, Monoid <Fail>, Eq <Fail> =>
 ma.Match(
     Fail : ex => List(Validation <MonoidFail, Fail, B> .Fail(ex)),
     Succ : xs => xs.Map(x => Success <MonoidFail, Fail, B>(f(x))));
 public static IObservable <R2> MatchObservable <FAIL, SUCCESS, R2>(this Validation <FAIL, SUCCESS> ma, Func <SUCCESS, IObservable <R2> > Succ, Func <Seq <FAIL>, IObservable <R2> > Fail) =>
 ma.Match(Succ: Succ, Fail: Fail);
Ejemplo n.º 6
0
 public static HashSet <Validation <Fail, B> > Traverse <Fail, A, B>(this Validation <Fail, HashSet <A> > ma, Func <A, B> f) =>
 ma.Match(
     Fail: es => HashSet(Validation <Fail, B> .Fail(es)),
     Succ: xs => xs.Map(x => Success <Fail, B>(f(x))));
Ejemplo n.º 7
0
 public static Stck <Validation <Fail, B> > Traverse <Fail, A, B>(this Validation <Fail, Stck <A> > ma, Func <A, B> f) =>
 ma.Match(
     Fail: ex => Stack(Validation <Fail, B> .Fail(ex)),
     Succ: xs => toStack(xs.Map(x => Success <Fail, B>(f(x)))));
 public static IObservable <R2> MatchObservable <FAIL, SUCCESS, R2>(this Validation <FAIL, SUCCESS> ma, Func <SUCCESS, IObservable <R2> > Succ, Func <Seq <FAIL>, R2> Fail) =>
 ma.Match(Succ: Succ, Fail: x => Observable.Return(Fail(x)));
Ejemplo n.º 9
0
 public static IEnumerable <Validation <Fail, B> > Traverse <Fail, A, B>(this Validation <Fail, IEnumerable <A> > ma, Func <A, B> f) =>
 ma.Match(
     Fail: es => new[] { Validation <Fail, B> .Fail(es) },
     Succ: xs => xs.Map(x => Success <Fail, B>(f(x))));
Ejemplo n.º 10
0
 public static IEnumerable <Validation <MonoidFail, Fail, B> > Traverse <MonoidFail, Fail, A, B>(this Validation <MonoidFail, Fail, IEnumerable <A> > ma, Func <A, B> f)
     where MonoidFail : struct, Monoid <Fail>, Eq <Fail> =>
 ma.Match(
     Fail : es => new[] { Validation <MonoidFail, Fail, B> .Fail(es) },
     Succ: xs => xs.Map(x => Success <MonoidFail, Fail, B>(f(x))));
Ejemplo n.º 11
0
 public static Arr <Validation <Fail, B> > Traverse <Fail, A, B>(this Validation <Fail, Arr <A> > ma, Func <A, B> f) =>
 ma.Match(
     Fail: e => Array(Validation <Fail, B> .Fail(e)),
     Succ: xs => xs.Map(x => Success <Fail, B>(f(x))));
Ejemplo n.º 12
0
 public static Que <Validation <Fail, B> > Traverse <Fail, A, B>(this Validation <Fail, Que <A> > ma, Func <A, B> f) =>
 ma.Match(
     Fail: ex => Queue(Validation <Fail, B> .Fail(ex)),
     Succ: xs => toQueue(xs.Map(x => Success <Fail, B>(f(x)))));
Ejemplo n.º 13
0
 public static Identity <Validation <MonoidFail, Fail, B> > Traverse <MonoidFail, Fail, A, B>(this Validation <MonoidFail, Fail, Identity <A> > ma, Func <A, B> f)
     where MonoidFail : struct, Monoid <Fail>, Eq <Fail> =>
 ma.Match(
     Succ : x => new Identity <Validation <MonoidFail, Fail, B> >(f(x.Value)),
     Fail : e => new Identity <Validation <MonoidFail, Fail, B> >(Validation <MonoidFail, Fail, B> .Fail(e)));
Ejemplo n.º 14
0
 public static Identity <Validation <Fail, B> > Traverse <Fail, A, B>(this Validation <Fail, Identity <A> > ma, Func <A, B> f) =>
 ma.Match(
     Succ: x => new Identity <Validation <Fail, B> >(f(x.Value)),
     Fail: e => new Identity <Validation <Fail, B> >(Validation <Fail, B> .Fail(e)));
Ejemplo n.º 15
0
 public static IObservable <R2> MatchObservable <MonoidFail, FAIL, SUCCESS, R2>(this Validation <MonoidFail, FAIL, SUCCESS> ma, Func <SUCCESS, IObservable <R2> > Succ, Func <FAIL, IObservable <R2> > Fail) where MonoidFail : struct, Monoid <FAIL>, Eq <FAIL> =>
 ma.Match(Succ : Succ, Fail : Fail);