public static PairAndSemigroup <X, C> SelectMany <X, A, B, C>(this PairAndSemigroup <X, A> ps, Func <A, PairAndSemigroup <X, B> > p, Func <A, B, C> f) { return(SelectMany(ps, a => Select(p(a), b => f(a, b)))); }
public static PairAndSemigroup <X, B> SelectMany <X, A, B>(this PairAndSemigroup <X, A> ps, Func <A, PairAndSemigroup <X, B> > f) { var r = f(ps.b); return(new PairAndSemigroup <X, B>(ps.S.Op(ps.a, r.a).And(r.b), ps.S)); }
public PairAndSemigroup <A, Pair <B, C> > Zip <C>(PairAndSemigroup <A, C> o) { return(ZipWith <C, Pair <B, C> >(o, Pair <B, C> .pairF())); }
public static PairAndSemigroup <X, B> Select <X, A, B>(this PairAndSemigroup <X, A> ps, Func <A, B> f) { return(new PairAndSemigroup <X, B>(ps.Pair.Select(f), ps.S)); }
public PairAndSemigroup <A, D> ZipWith <C, D>(PairAndSemigroup <A, C> o, Func <B, Func <C, D> > f) { return(this.SelectMany(a => o.Select(b => f(a)(b)))); }