public static Lens <T, V> Compose <T, U, V>(
     this Lens <T, U> lens1,
     Lens <U, V> lens2)
 {
     return(new Lens <T, V>(
                x => lens2.Get(lens1.Get(x)),
                (v, x) => lens1.Set(x, lens2.Set(lens1.Get(x), v))));
 }
Exemplo n.º 2
0
 public override B Update(Func <B, B> f) =>
 lens.Get(target.Update(x => lens.Set(x, f(lens.Get(x)))));
Exemplo n.º 3
0
 public static Lens <S, T, C, D> Compose <S, T, A, B, C, D>(this Lens <S, T, A, B> @this, Lens <A, B, C, D> other) => Lens <S, T, C, D> .Of(@this.Get.Compose(other.Get), (d, s) => @this.Set(other.Set(d, @this.Get(s)), s));
Exemplo n.º 4
0
 public static Lens <S, T, List <A>, List <A> > At <S, T, A>(this Lens <S, T, List <A>, List <A> > @this, int index) => Lens <S, T, List <A>, List <A> > .Of(s => List(@this.Get(s)[index]), (e, s) => @this.Set(List(@this.Get(s)[index] = e[0]), s));
Exemplo n.º 5
0
 public static Func <S, T> Over <S, T, A, B>(this Lens <S, T, A, B> @this, Func <A, B> f) => s => @this.Set(f(@this.Get(s)), s);