Esempio n. 1
0
        public static Func <T, IPromise <ControlValue <E> > > Canonical <T, E>(this PromiseFactory factory, Func <T, IPromise <NullableResult <E> > > fn)
        {
            return(factory.Canonical <T, E>(x => factory.SafeThen(fn(x), result =>
            {
                if (result == null || !result.HasResult)
                {
                    return ControlValue <E> .Next;
                }

                return ControlValue <E> .Return(result.Result);
            })));
        }
Esempio n. 2
0
 public static IPromise <E> SafeThen <T, E>(this PromiseFactory factory, IPromise <T> next, Func <T, E> conusmer)
 {
     return(factory.SafeThen(next, x => factory.Value(conusmer(x))));
 }
Esempio n. 3
0
 public static IPromise <E> SafeThen <T, E>(this PromiseFactory factory, IPromise <T> next, Func <IPromise <E> > consumer)
 {
     return(factory.SafeThen(next, x => consumer()));
 }
Esempio n. 4
0
 public static Func <T, IPromise <ControlValue <object> > > Canonical <T>(this PromiseFactory factory, Func <T, IPromise> fn)
 {
     return(factory.Canonical <T, object>(x => factory.SafeThen(fn(x), () => ControlValue <object> .Next)));
 }
Esempio n. 5
0
 public static Func <T, IPromise <ControlValue <object> > > Canonical <T>(this PromiseFactory factory, Func <T, IPromise <ControlState> > fn)
 {
     return(factory.Canonical <T, object>(x => factory.SafeThen(fn(x), result => new ControlValue <object>(result))));
 }
Esempio n. 6
0
 public static Func <T, IPromise <ControlValue <E> > > Canonical <T, E>(this PromiseFactory factory, Func <T, IPromise <E> > fn)
 {
     return(factory.Canonical <T, E>(x => factory.SafeThen(fn(x), result => ControlValue <E> .Return(result))));
 }
Esempio n. 7
0
 public static Func <IPromise <ControlValue <T> > > Canonical <T>(this PromiseFactory factory, Func <IPromise> fn)
 {
     return(factory.Canonical <T>(() => factory.SafeThen(fn, () => ControlState.Next)));
 }
Esempio n. 8
0
 public static IPromise SafeThen(this PromiseFactory factory, Func <IPromise> next, Action consumer)
 {
     return(factory.SafeThen(next(), consumer));
 }
Esempio n. 9
0
 public static Func <IPromise <ControlValue <T> > > Canonical <T>(this PromiseFactory factory, Func <IPromise <ControlState> > fn)
 {
     return(factory.Canonical(() => factory.SafeThen(fn, result => new ControlValue <T>(result))));
 }
Esempio n. 10
0
 public static IPromise SafeThen(this PromiseFactory factory, IPromise next, Action consumer)
 {
     return(factory.SafeThen(next, consumer.ReturnPromise(factory)));
 }
Esempio n. 11
0
 public static IPromise <T> SafeThen <T>(this PromiseFactory factory, Func <IPromise> next, Func <T> consumer)
 {
     return(factory.SafeThen(next(), consumer));
 }
Esempio n. 12
0
 public static IPromise SafeThen(this PromiseFactory factory, IPromise next, Func <IPromise> consumer)
 {
     return(factory.SafeThen(next, () => consumer().UnCast(factory)).Cast());
 }
Esempio n. 13
0
 public static IPromise <T> SafeThen <T>(this PromiseFactory factory, IPromise next, Func <T> conusmer)
 {
     return(factory.SafeThen(next, () => factory.Value(conusmer())));
 }
Esempio n. 14
0
 public static IPromise <T> SafeThen <T>(this PromiseFactory factory, IPromise next, Func <IPromise <T> > consumer)
 {
     return(factory.SafeThen(next.UnCast(factory), consumer));
 }
Esempio n. 15
0
 public static IPromise SafeThen <T>(this PromiseFactory factory, IPromise <T> next, Action consumer)
 {
     return(factory.SafeThen(next, x => consumer()));
 }
Esempio n. 16
0
 public static IPromise SafeThen <T>(this PromiseFactory factory, IPromise <T> next, Func <T, IPromise> consumer)
 {
     return(factory.SafeThen(next, x => consumer(x).UnCast(factory)).Cast());
 }