|
9 | 9 | import java.util.function.BiFunction; |
10 | 10 | import java.util.function.Function; |
11 | 11 |
|
12 | | -import static com.jnape.palatable.lambda.functions.builtin.fn1.Id.id; |
13 | 12 | import static com.jnape.palatable.lambda.lens.Lens.Simple.adapt; |
14 | 13 | import static com.jnape.palatable.lambda.lens.functions.Over.over; |
15 | 14 | import static com.jnape.palatable.lambda.lens.functions.Set.set; |
@@ -214,7 +213,7 @@ default <R> Lens<R, T, A, B> contraMap(Function<? super R, ? extends S> fn) { |
214 | 213 | * @return the new lens |
215 | 214 | */ |
216 | 215 | default <R> Lens<R, T, A, B> mapS(Function<? super R, ? extends S> fn) { |
217 | | - return compose(lens(fn, (r, t) -> t)); |
| 216 | + return lens(view(this).compose(fn), (r, b) -> set(this, b, fn.apply(r))); |
218 | 217 | } |
219 | 218 |
|
220 | 219 | /** |
@@ -247,7 +246,7 @@ default <C> Lens<S, T, C, B> mapA(Function<? super A, ? extends C> fn) { |
247 | 246 | * @return the new lens |
248 | 247 | */ |
249 | 248 | default <Z> Lens<S, T, A, Z> mapB(Function<? super Z, ? extends B> fn) { |
250 | | - return andThen(lens(id(), (a, z) -> fn.apply(z))); |
| 249 | + return lens(view(this), (s, z) -> set(this, fn.apply(z), s)); |
251 | 250 | } |
252 | 251 |
|
253 | 252 | /** |
|
0 commit comments