public static Lst <Fin <B> > Traverse <A, B>(this Fin <Lst <A> > ma, Func <A, B> f) => ma.Match( Fail: er => List(Fin <B> .Fail(er)), Succ: xs => xs.Map(x => FinSucc(f(x))));
public static IEnumerable <Fin <B> > Traverse <A, B>(this Fin <IEnumerable <A> > ma, Func <A, B> f) => ma.Match( Fail: er => new[] { Fin <B> .Fail(er) }, Succ: xs => xs.Map(x => FinSucc(f(x))));
public static Que <Fin <B> > Traverse <A, B>(this Fin <Que <A> > ma, Func <A, B> f) => ma.Match( Fail: er => Queue(FinFail <B>(er)), Succ: xs => xs.Map(x => FinSucc(f(x))));
public static Stck <Fin <B> > Traverse <A, B>(this Fin <Stck <A> > ma, Func <A, B> f) => ma.Match( Fail: er => Stack(FinFail <B>(er)), Succ: xs => xs.Map(x => FinSucc(f(x))));
/// <summary> /// Invokes the Succ or Fail action depending on the state of the Fin provided /// </summary> /// <typeparam name="A">Bound value type</typeparam> /// <param name="ma">Fin to match</param> /// <param name="Succ">Action to invoke if in a Succ state</param> /// <param name="Fail">Action to invoke if in a Fail state</param> /// <returns>Unit</returns> public static Unit match <A>(Fin <A> ma, Action <A> Succ, Action <Error> Fail) => ma.Match(Succ, Fail);
public static B match <A, B>(Fin <A> ma, Func <A, B> Succ, Func <Error, B> Fail) => ma.Match(Succ, Fail);
public static Arr <Fin <B> > Traverse <A, B>(this Fin <Arr <A> > ma, Func <A, B> f) => ma.Match( Fail: er => Array(Fin <B> .Fail(er)), Succ: xs => xs.Map(x => FinSucc(f(x))));
public static Identity <Fin <B> > Traverse <A, B>(this Fin <Identity <A> > ma, Func <A, B> f) => ma.Match( Succ: x => new Identity <Fin <B> >(f(x.Value)), Fail: e => new Identity <Fin <B> >(Fin <B> .Fail(e)));