@@ -220,27 +220,13 @@ default Iso<S, T, A, B> toIso(S s) {
220220 return iso (view (this ), set (this ).flip ().apply (s ));
221221 }
222222
223- /**
224- * Left-to-right composition of lenses. Requires compatibility between S and T.
225- *
226- * @param f the other lens
227- * @param <C> the new "smaller" value to read (previously A)
228- * @param <D> the new "smaller" update value (previously B)
229- * @return the composed lens
230- */
231- default <C , D > Lens <S , T , C , D > andThen (Lens <A , B , C , D > f ) {
232- return f .compose (this );
223+ @ Override
224+ default <C , D > Lens <S , T , C , D > andThen (LensLike <A , B , C , D , ?> f ) {
225+ return lens (view (this ).fmap (view (f )), (q , b ) -> over (this , set (f , b ), q ));
233226 }
234227
235- /**
236- * Right-to-left composition of lenses. Requires compatibility between A and B.
237- *
238- * @param g the other lens
239- * @param <Q> the new "larger" value for reading (previously S)
240- * @param <R> the new "larger" value for putting (previously T)
241- * @return the composed lens
242- */
243- default <Q , R > Lens <Q , R , A , B > compose (Lens <Q , R , S , T > g ) {
228+ @ Override
229+ default <Q , R > Lens <Q , R , A , B > compose (LensLike <Q , R , S , T , ?> g ) {
244230 return lens (view (g ).fmap (view (this )), (q , b ) -> over (g , set (this , b ), q ));
245231 }
246232
@@ -323,26 +309,12 @@ static <S, A, B> Lens.Simple<S, Tuple2<A, B>> both(Lens.Simple<S, A> f, Lens.Sim
323309 @ FunctionalInterface
324310 interface Simple <S , A > extends Lens <S , S , A , A >, LensLike .Simple <S , A , Lens > {
325311
326- /**
327- * Compose two simple lenses from right to left.
328- *
329- * @param g the other simple lens
330- * @param <R> the other simple lens' larger type
331- * @return the composed simple lens
332- */
333- default <R > Lens .Simple <R , A > compose (Lens .Simple <R , S > g ) {
312+ default <R > Lens .Simple <R , A > compose (LensLike .Simple <R , S , ?> g ) {
334313 return Lens .Simple .adapt (Lens .super .compose (g ));
335314 }
336315
337- /**
338- * Compose two simple lenses from left to right.
339- *
340- * @param f the other simple lens
341- * @param <B> the other simple lens' smaller type
342- * @return the composed simple lens
343- */
344- default <B > Lens .Simple <S , B > andThen (Lens .Simple <A , B > f ) {
345- return f .compose (this );
316+ default <B > Lens .Simple <S , B > andThen (LensLike .Simple <A , B , ?> f ) {
317+ return Lens .Simple .adapt (Lens .super .andThen (f ));
346318 }
347319
348320 /**
0 commit comments