Example #1
0
 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))));
 }
Example #2
0
        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));
        }
Example #3
0
 public PairAndSemigroup <A, Pair <B, C> > Zip <C>(PairAndSemigroup <A, C> o)
 {
     return(ZipWith <C, Pair <B, C> >(o, Pair <B, C> .pairF()));
 }
Example #4
0
 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));
 }
Example #5
0
 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))));
 }