Пример #1
0
 public Iteratee <D, A> ContraSelect <D>(Func <D, E> f)
 {
     return(Fold(
                (a, i) => Iteratee <D, A> .Done(a, i.IsEof ? Input <D> .Eof() : Input <D> .Empty())
                , r => Iteratee <D, A> .Cont(i => r(i.Select(f)).ContraSelect(f))
                ));
 }
Пример #2
0
 public static Iteratee <E, B> SelectMany <E, A, B>(this Iteratee <E, A> k, Func <A, Iteratee <E, B> > f) =>
 k.Fold(
     (a, i) => i.IsEmpty ?
     f(a) :
     f(a).Fold(
         (b, _) => Iteratee <E, B> .Done(b, i)
         , s => s(i)
         )
     , r => Iteratee <E, B> .Cont(u => r(u).SelectMany(f))
     );
Пример #3
0
 public Iteratee <E, A> Done <A>(A a)
 {
     return(Iteratee <E, A> .Done(a, this));
 }
Пример #4
0
 public static Iteratee <E, A> Flatten <E, A>(this Iteratee <E, Iteratee <E, A> > o)
 {
     return(o.SelectMany(z => z));
 }
Пример #5
0
 public static Iteratee <E, B> Apply <E, A, B>(this Iteratee <E, Func <A, B> > f, Iteratee <E, A> o)
 {
     return(f.SelectMany(g => o.Select(p => g(p))));
 }
Пример #6
0
 public static Iteratee <E, C> SelectMany <E, A, B, C>(this Iteratee <E, A> k, Func <A, Iteratee <E, B> > p, Func <A, B, C> f)
 {
     return(SelectMany(k, a => Select(p(a), b => f(a, b))));
 }
Пример #7
0
 public static Iteratee <E, B> Select <E, A, B>(this Iteratee <E, A> k, Func <A, B> f)
 {
     return(k.SelectMany <E, A, B>(a => Iteratee <E, B> .Done(f(a), Input <E> .Empty())));
 }
Пример #8
0
 public Iteratee <E, Pair <A, B> > Zip <B>(Iteratee <E, B> o)
 {
     return(ZipWith <B, Pair <A, B> >(o, Pair <A, B> .pairF()));
 }
Пример #9
0
 public Iteratee <E, C> ZipWith <B, C>(Iteratee <E, B> o, Func <A, Func <B, C> > f)
 {
     return(this.SelectMany(a => o.Select(b => f(a)(b))));
 }
Пример #10
0
 public Iteratee <E, A> Done <A>(A a) => Iteratee <E, A> .Done(a, this);
Пример #11
0
 public static Iteratee <E, A> Flatten <E, A>(this Iteratee <E, Iteratee <E, A> > o) => o.SelectMany(z => z);
Пример #12
0
 public Iteratee <E, Pair <A, B> > Zip <B>(Iteratee <E, B> o) => ZipWith(o, Pair <A, B> .pairF());