Exemplo n.º 1
0
 public static IEnumerable <Eff <B> > Traverse <A, B>(this Eff <IEnumerable <A> > ma, Func <A, B> f) =>
 ma.Match(
     Fail: ex => new [] { FailEff <B>(ex) },
     Succ: xs => xs.Map(x => SuccessEff <B>(f(x)))).Run().Value;
Exemplo n.º 2
0
 public static Lst <Eff <B> > Traverse <A, B>(this Eff <Lst <A> > ma, Func <A, B> f) =>
 ma.Match(
     Fail: ex => List(FailEff <B>(ex)),
     Succ: xs => xs.Map(x => SuccessEff <B>(f(x)))).Run().Value;
Exemplo n.º 3
0
 public static Identity <Eff <B> > Traverse <A, B>(this Eff <Identity <A> > ma, Func <A, B> f) =>
 ma.Match(
     Succ: x => new Identity <Eff <B> >(SuccessEff(f(x.Value))),
     Fail: e => new Identity <Eff <B> >(FailEff <B>(e)))
 .Run().Value;