public bool Eq(Either <X, A> t1, Either <X, A> t2) { return(t1.Cata( x1 => t2.Cata( x2 => xeq.Eq(x1, x2), a2 => false), a1 => t2.Cata( x2 => false, a2 => aeq.Eq(a1, a2)))); }
public static bool LeftTest <X, A>(this Either <X, A> either, Func <X, bool> predicate) { return(either.Cata(predicate, a => false)); }
public static bool RightTest <X, A>(this Either <X, A> either, Func <A, bool> predicate) { return(either.Cata(x => false, predicate)); }
public static IEnumerable <X> LeftEnumerable <X, A>(this Either <X, A> either) { return(either.Cata( x => x.PureEnumerable(), a => Enumerable.Empty <X>())); }
public static IEnumerable <A> RightEnumerable <X, A>(this Either <X, A> either) { return(either.Cata( x => Enumerable.Empty <A>(), a => a.PureEnumerable())); }
public static Maybe <X> LeftMaybe <X, A>(this Either <X, A> either) { return(either.Cata( Maybe.Just, a => Maybe.Nothing <X>())); }
public static Maybe <A> RightMaybe <X, A>(this Either <X, A> either) { return(either.Cata( x => Maybe.Nothing <A>(), Maybe.Just)); }
public static Validation <X, A> Validation <X, A>(this Either <X, A> either) { return(either.Cata( Jib.Validation.Failure <X, A>, Jib.Validation.Success <X, A>)); }
public static Either <Y, A> BindLeft <X, Y, A>(this Either <X, A> either, Func <X, Either <Y, A> > f) { return(either.Cata(f, Either.Right <Y, A>)); }
public static Either <X, B> Bind <X, A, B>(this Either <X, A> either, Func <A, Either <X, B> > f) { return(either.Cata(Either.Left <X, B>, f)); }
public static void CataVoid <X, A>(this Either <X, A> either, Action <X> left, Action <A> right) { either.Cata(Unit.Func(left), Unit.Func(right)); }
public Either <X, B> Map <X, A, B>(Either <X, A> either, Func <A, B> f) { return(either.Cata(Either.Left <X, B>, a => Either.Right <X, B>(f(a)))); }
public static IEnumerable <Either <X, A> > SequenceEnumerable <X, A>(this Either <X, IEnumerable <A> > either) { return(either.Cata( x => Either.Left <X, A>(x).PureEnumerable(), a => a.Select(Either.Right <X, A>))); }
public static IEnumerable <Either <X, B> > TraverseEnumerable <A, B, X>(this Either <X, A> either, Func <A, IEnumerable <B> > f) { return(either.Cata( x => Either.Left <X, B>(x).PureEnumerable(), a => f(a).Select(Either.Right <X, B>))); }