コード例 #1
0
 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))));
 }
コード例 #2
0
ファイル: Atom.cs プロジェクト: rkoeninger/KitchenSink
 public override B Update(Func <B, B> f) =>
 lens.Get(target.Update(x => lens.Set(x, f(lens.Get(x)))));
コード例 #3
0
ファイル: Lens.cs プロジェクト: endofunk/Endofunk-FX
 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));
コード例 #4
0
ファイル: Lens.cs プロジェクト: endofunk/Endofunk-FX
 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));
コード例 #5
0
ファイル: Lens.cs プロジェクト: endofunk/Endofunk-FX
 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);