Example #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);
            })));
        }
Example #2
0
 public static Func <T, IPromise <ControlValue <object> > > Canonical <T>(this PromiseFactory factory, Action <T> fn)
 {
     return(factory.Canonical <T>(fn.ReturnPromise(factory)));
 }
Example #3
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)));
 }
Example #4
0
 public static Func <T, IPromise <ControlValue <object> > > Canonical <T>(this PromiseFactory factory, Func <T, ControlState> fn)
 {
     return(factory.Canonical <T, object>(x => factory.Value(fn(x))));
 }
Example #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))));
 }
Example #6
0
 public static Func <T, IPromise <ControlValue <E> > > Canonical <T, E>(this PromiseFactory factory, Func <T, E> fn)
 {
     return(factory.Canonical <T, E>(x => factory.Value(fn(x))));
 }
Example #7
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))));
 }
Example #8
0
 public static Func <IPromise <ControlValue <object> > > Canonical(this PromiseFactory factory, Action fn)
 {
     return(factory.Canonical <object>(fn));
 }
Example #9
0
 public static Func <IPromise <ControlValue <T> > > Canonical <T>(this PromiseFactory factory, Func <ControlState> fn)
 {
     return(factory.Canonical <T>(() => factory.Value(fn())));
 }
Example #10
0
 public static Func <IPromise <ControlValue <T> > > Canonical <T>(this PromiseFactory factory, Func <IPromise> fn)
 {
     return(factory.Canonical <T>(() => factory.SafeThen(fn, () => ControlState.Next)));
 }
Example #11
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))));
 }
Example #12
0
 public static Func <IPromise <ControlValue <T> > > Canonical <T>(this PromiseFactory factory, Func <NullableResult <T> > fn)
 {
     return(factory.Canonical(() => factory.Value(fn())));
 }
Example #13
0
 public Scope <T> Run(Func <ControlValue <T> > action)
 {
     return(Run(_factory.Canonical(action)));
 }
Example #14
0
 public IPromise <ControlValue <T> > Do <T>(Func <ControlValue <T> > body)
 {
     return(Do(_factory.Canonical(body)));
 }
Example #15
0
 public For <T> Iterate(Func <T, ControlValue <T> > iterator)
 {
     return(Iterate(_factory.Canonical(iterator)));
 }