@@ -110,12 +110,12 @@ public abstract class POptional<S, T, A, B> {
110110 * matching
111111 */
112112 public final F <S , Option <T >> modifyOption (final F <A , B > f ) {
113- return s -> getOption (s ).map (__ -> modify (f ).f (s ));
113+ return s -> getOption (s ).map (Function . constant ( modify (f ).f (s ) ));
114114 }
115115
116116 /** set polymorphically the target of a {@link POptional} with a value. return empty if the {@link POptional} is not matching */
117117 public final F <S , Option <T >> setOption (final B b ) {
118- return modifyOption (__ -> b );
118+ return modifyOption (Function . constant ( b ) );
119119 }
120120
121121 /** check if a {@link POptional} has a target */
@@ -385,89 +385,89 @@ public Option<A> getOption(final S s) {
385385
386386 @ Override
387387 public <C > F <S , F <C , T >> modifyFunctionF (final F <A , F <C , B >> f ) {
388- return s -> getOrModify (s ).either (
388+ return s -> getOrModify . f (s ).either (
389389 Function .constant (),
390- a -> Function .compose (b -> set (b ).f (s ), f .f (a ))
390+ a -> Function .compose (b -> set . f (b ).f (s ), f .f (a ))
391391 );
392392 }
393393
394394 @ Override
395395 public <L > F <S , Either <L , T >> modifyEitherF (final F <A , Either <L , B >> f ) {
396- return s -> getOrModify (s ).either (
396+ return s -> getOrModify . f (s ).either (
397397 Either .right_ (),
398- t -> f .f (t ).right ().map (b -> set (b ).f (s ))
398+ t -> f .f (t ).right ().map (b -> set . f (b ).f (s ))
399399 );
400400 }
401401
402402 @ Override
403403 public F <S , IO <T >> modifyIOF (final F <A , IO <B >> f ) {
404- return s -> getOrModify (s ).either (
404+ return s -> getOrModify . f (s ).either (
405405 IOFunctions ::unit ,
406- t -> IOFunctions .<B , T > map (f .f (t ), b -> set (b ).f (s ))
406+ t -> IOFunctions .<B , T > map (f .f (t ), b -> set . f (b ).f (s ))
407407 );
408408 }
409409
410410 @ Override
411411 public F <S , Trampoline <T >> modifyTrampolineF (final F <A , Trampoline <B >> f ) {
412- return s -> getOrModify (s ).either (
412+ return s -> getOrModify . f (s ).either (
413413 Trampoline .pure (),
414- t -> f .f (t ).map (b -> set (b ).f (s ))
414+ t -> f .f (t ).map (b -> set . f (b ).f (s ))
415415 );
416416 }
417417
418418 @ Override
419419 public F <S , Promise <T >> modifyPromiseF (final F <A , Promise <B >> f ) {
420- return s -> getOrModify (s ).either (
420+ return s -> getOrModify . f (s ).either (
421421 t -> Promise .promise (Strategy .idStrategy (), P .p (t )),
422- t -> f .f (t ).fmap (b -> set (b ).f (s ))
422+ t -> f .f (t ).fmap (b -> set . f (b ).f (s ))
423423 );
424424 }
425425
426426 @ Override
427427 public F <S , List <T >> modifyListF (final F <A , List <B >> f ) {
428- return s -> getOrModify (s ).either (
428+ return s -> getOrModify . f (s ).either (
429429 List ::single ,
430- t -> f .f (t ).map (b -> set (b ).f (s ))
430+ t -> f .f (t ).map (b -> set . f (b ).f (s ))
431431 );
432432 }
433433
434434 @ Override
435435 public F <S , Option <T >> modifyOptionF (final F <A , Option <B >> f ) {
436- return s -> getOrModify (s ).either (
436+ return s -> getOrModify . f (s ).either (
437437 Option .some_ (),
438- t -> f .f (t ).map (b -> set (b ).f (s ))
438+ t -> f .f (t ).map (b -> set . f (b ).f (s ))
439439 );
440440 }
441441
442442 @ Override
443443 public F <S , Stream <T >> modifyStreamF (final F <A , Stream <B >> f ) {
444- return s -> getOrModify (s ).either (
444+ return s -> getOrModify . f (s ).either (
445445 Stream .single (),
446- t -> f .f (t ).map (b -> set (b ).f (s ))
446+ t -> f .f (t ).map (b -> set . f (b ).f (s ))
447447 );
448448 }
449449
450450 @ Override
451451 public F <S , P1 <T >> modifyP1F (final F <A , P1 <B >> f ) {
452- return s -> getOrModify (s ).either (
452+ return s -> getOrModify . f (s ).either (
453453 P .p1 (),
454- t -> f .f (t ).map (b -> set (b ).f (s ))
454+ t -> f .f (t ).map (b -> set . f (b ).f (s ))
455455 );
456456 }
457457
458458 @ Override
459459 public <E > F <S , Validation <E , T >> modifyValidationF (final F <A , Validation <E , B >> f ) {
460- return s -> getOrModify (s ).either (
460+ return s -> getOrModify . f (s ).either (
461461 t -> Validation .<E , T > success (t ),
462- t -> f .f (t ).map (b -> set (b ).f (s ))
462+ t -> f .f (t ).map (b -> set . f (b ).f (s ))
463463 );
464464 }
465465
466466 @ Override
467467 public F <S , V2 <T >> modifyV2F (final F <A , V2 <B >> f ) {
468- return s -> getOrModify (s ).either (
468+ return s -> getOrModify . f (s ).either (
469469 t -> V2 .p (P .p (t , t )),
470- t -> f .f (t ).map (b -> set (b ).f (s ))
470+ t -> f .f (t ).map (b -> set . f (b ).f (s ))
471471 );
472472 }
473473
0 commit comments