Пример #1
0
 private static ILease <Y> Do <X, Y>(this ILendable <Y> output, Action <X, Y> render, ILease <X> lease)
 {
     return(lease.Extract(value =>
     {
         var target = output.GetLease();
         render(value, target.Value);
         return target;
     }));
 }
Пример #2
0
 public static ILendable <A> MakeLazy <A>(this ILendable <A> lendable)
 {
     return(new Deferred <A>(() => new Lazy <A>(() => lendable.GetLease())));
 }
Пример #3
0
 public static ILendable <C> SelectMany <A, B, C>(this ILendable <A> lendable, Func <A, ILendable <B> > bind, Func <A, B, C> select)
 {
     return(lendable
            .Bind((a) => bind(a)
                  .Map((b) => select(a, b))));
 }
Пример #4
0
 public static ILendable <B> SelectMany <A, B>(this ILendable <A> lendable, Func <A, ILendable <B> > f)
 {
     return(lendable.Bind(f));
 }
Пример #5
0
 public static ILendable <B> Select <A, B>(this ILendable <A> lendable, Func <A, B> f)
 {
     return(lendable.Map(f));
 }
Пример #6
0
 public static IFilter <B, Y> Compile <A, B, Y>(A description, ILendable <IFilterBase <IFilterOutput <B, Y> > > compiler)
     where A : B, IEquatable <B>
 {
     return(new CompiledFilter <A, B, Y>(description, compiler));
 }
Пример #7
0
 private static ILendable <Y> Do <X, Y>(this ILendable <Y> output, Action <X, Y> render, ILendable <X> input)
 {
     return(input.MapLease(lease => new Lazy <Y>(() => output.Do(render, lease))));
 }
Пример #8
0
 public Result(TDescription description, ILendable <TValue> value)
 {
     m_Description = description;
     m_Value       = value;
 }
Пример #9
0
 public static ILendable <B> BindLease <A, B>(this ILendable <A> lendable, Func <ILease <A>, ILease <ILendable <B> > > f)
 {
     return(new Bound <A, B>(lendable, f));
 }
Пример #10
0
 public static B Extract <A, B>(this ILendable <A> lendable, Func <A, B> callback)
 {
     return(lendable.GetLease().Extract(callback));
 }
Пример #11
0
 public static void Extract <A>(this ILendable <A> lendable, Action <A> callback)
 {
     lendable.GetLease().Extract(callback);
 }
Пример #12
0
 public Bound(ILendable <TInput> lendable, Func <ILease <TInput>, ILease <ILendable <TOutput> > > func)
     : base(lendable, lease => func(lease).Bind(x => x.GetLease()))
 {
 }
Пример #13
0
 public Mapped(ILendable <TInput> lendable, Func <ILease <TInput>, ILease <TOutput> > func)
     : base(() => func(lendable.GetLease()))
 {
 }
Пример #14
0
 public CheckedFilterOutput(TCheck description, ILendable <IFilterBase <IFilterOutput <TDescription, TValue> > > compiler)
     : base(compiler.GetLease)
 {
     m_Description = description;
 }
Пример #15
0
 public static IFilterOutput <B, Y> Do <B, X, Y>(this IFilterOutput <B, Y> output, Action <X, Y> render, ILendable <X> input)
 {
     return(Return(output.Description, output.Do <X, Y>(render, input)));
 }
Пример #16
0
 public static void Extract <A>(this ILendable <A> output, Action <A> callback)
 {
     LendableHelper.Extract(output, callback);
 }
Пример #17
0
 public static ILendable <B> MapLease <A, B>(this ILendable <A> lendable, Func <ILease <A>, ILease <B> > f)
 {
     return(new Mapped <A, B>(lendable, f));
 }
Пример #18
0
 public static ILendable <B> Bind <A, B>(this ILendable <A> lendable, Func <A, ILendable <B> > f)
 {
     return(new Bound <A, B>(lendable, x => x.Map(f)));
 }
Пример #19
0
 public static ILendable <B> Map <A, B>(this ILendable <A> lendable, Func <A, B> f)
 {
     return(new Mapped <A, B>(lendable, x => x.Map(f)));
 }
Пример #20
0
 public static IFilterOutput <A, X> Return <A, X>(A description, ILendable <X> value)
 {
     return(new Result <A, X>(description, value));
 }
Пример #21
0
 public CompiledFilter(TCheck description, ILendable <IFilterBase <IFilterOutput <TDescription, TValue> > > compiler)
     : base(description, compiler)
 {
 }