示例#1
0
 public static PairAndMonoid <X, C> SelectMany <X, A, B, C>(this PairAndMonoid <X, A> ps, Func <A, PairAndMonoid <X, B> > p, Func <A, B, C> f)
 {
     return(SelectMany(ps, a => Select(p(a), b => f(a, b))));
 }
示例#2
0
        public static PairAndMonoid <X, B> SelectMany <X, A, B>(this PairAndMonoid <X, A> ps, Func <A, PairAndMonoid <X, B> > f)
        {
            var r = f(ps.b);

            return(new PairAndMonoid <X, B>(Pair <X, B> .pair(ps.M.Op(ps.a, r.a), r.b), ps.M));
        }
示例#3
0
 public static PairAndMonoid <X, B> Select <X, A, B>(this PairAndMonoid <X, A> ps, Func <A, B> f)
 {
     return(new PairAndMonoid <X, B>(ps.Pair.Select(f), ps.M));
 }
示例#4
0
 public PairAndMonoid <A, Pair <B, C> > Zip <C>(PairAndMonoid <A, C> o)
 {
     return(ZipWith <C, Pair <B, C> >(o, Pair <B, C> .pairF()));
 }
示例#5
0
 public PairAndMonoid <A, D> ZipWith <C, D>(PairAndMonoid <A, C> o, Func <B, Func <C, D> > f)
 {
     return(this.SelectMany(a => o.Select(b => f(a)(b))));
 }
示例#6
0
 public PairAndMonoid <A, Pair <B, C> > Zip <C>(PairAndMonoid <A, C> o) => ZipWith(o, Pair <B, C> .pairF());