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)) )); }
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)) );
public Iteratee <E, A> Done <A>(A a) { return(Iteratee <E, A> .Done(a, this)); }
public static Iteratee <E, A> Flatten <E, A>(this Iteratee <E, Iteratee <E, A> > o) { return(o.SelectMany(z => z)); }
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)))); }
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)))); }
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()))); }
public Iteratee <E, Pair <A, B> > Zip <B>(Iteratee <E, B> o) { return(ZipWith <B, Pair <A, B> >(o, Pair <A, B> .pairF())); }
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)))); }
public Iteratee <E, A> Done <A>(A a) => Iteratee <E, A> .Done(a, this);
public static Iteratee <E, A> Flatten <E, A>(this Iteratee <E, Iteratee <E, A> > o) => o.SelectMany(z => z);
public Iteratee <E, Pair <A, B> > Zip <B>(Iteratee <E, B> o) => ZipWith(o, Pair <A, B> .pairF());