Beispiel #1
0
 public PairAndMonoid <A, Pair <B, C> > Zip <C>(PairAndMonoid <A, C> o)
 {
     return(ZipWith <C, Pair <B, C> >(o, Pair <B, C> .pairF()));
 }
Beispiel #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));
        }
Beispiel #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()));
 }
Beispiel #4
0
 internal PairAndMonoid(Pair <A, B> pair, Monoid <A> m)
 {
     this.pair = pair;
     this.m    = m;
 }
Beispiel #5
0
 internal PairAndSemigroup(Pair <A, B> pair, Semigroup <A> s)
 {
     this.pair = pair;
     this.s    = s;
 }
Beispiel #6
0
 public static Pair <A, B> And <A, B>(this A a, B b)
 {
     return(Pair <A, B> .pair(a, b));
 }
Beispiel #7
0
 public static Pair <X, B> Select <X, A, B>(this Pair <X, A> ps, Func <A, B> f)
 {
     return(ps._1.Get.And(f(ps._2.Get)));
 }
Beispiel #8
0
 public List <Pair <A, B> > Product <B>(List <B> o)
 {
     return(ZipWith <B, Pair <A, B> >(o, Pair <A, B> .pairF()));
 }
Beispiel #9
0
 public List <Pair <A, B> > Zip <B>(List <B> bs)
 {
     return(ZipWith <B, Pair <A, B> >(bs, a => b => Pair <A, B> .pair(a, b)));
 }