Package fj.data.optic

Class PSetter<S,​T,​A,​B>

  • Type Parameters:
    S - the source of a PSetter
    T - the modified source of a PSetter
    A - the target of a PSetter
    B - the modified target of a PSetter
    Direct Known Subclasses:
    Setter

    public abstract class PSetter<S,​T,​A,​B>
    extends java.lang.Object
    A PSetter is a generalisation of Functor map:
    • map: (A => B) => F[A] => F[B]
    • modify: (A => B) => S => T

    PSetter stands for Polymorphic Setter as it set and modify methods change a type A to B and S to T.

    PTraversal, POptional, PPrism, PLens and PIso are valid PSetter

    • Constructor Detail

      • PSetter

        PSetter()
    • Method Detail

      • modify

        public abstract F<S,​T> modify​(F<A,​B> f)
        modify polymorphically the target of a PSetter with a function
      • set

        public abstract F<S,​T> set​(B b)
        set polymorphically the target of a PSetter with a value
      • composeLens

        public final <C,​D> PSetter<S,​T,​C,​D> composeLens​(PLens<A,​B,​C,​D> other)
        compose a PSetter with a PLens
      • composeIso

        public final <C,​D> PSetter<S,​T,​C,​D> composeIso​(PIso<A,​B,​C,​D> other)
        compose a PSetter with a PIso
      • pId

        public static <S,​T> PSetter<S,​T,​S,​T> pId()
      • pCodiagonal

        public static <S,​T> PSetter<Either<S,​S>,​Either<T,​T>,​S,​T> pCodiagonal()
      • pSetter

        public static <S,​T,​A,​B> PSetter<S,​T,​A,​B> pSetter​(F<F<A,​B>,​F<S,​T>> modify)