Interface ProtoOptic<P extends Profunctor<?,​?,​? extends P>,​S,​T,​A,​B>

  • Type Parameters:
    P - the Profunctor bound
    S - the left side of the output profunctor
    T - the right side's functor embedding of the output profunctor
    A - the left side of the input profunctor
    B - the right side's functor embedding of the input profunctor
    All Superinterfaces:
    Optic<P,​Identity<?>,​S,​T,​A,​B>
    All Known Subinterfaces:
    Prism<S,​T,​A,​B>, Prism.Simple<S,​A>
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface ProtoOptic<P extends Profunctor<?,​?,​? extends P>,​S,​T,​A,​B>
    extends Optic<P,​Identity<?>,​S,​T,​A,​B>
    A generic supertype representation for a profunctor Optic that requires a Pure implementation to derive its Functor constraint and graduate to a full-fledge Optic, equipped with a default Optic instance for the profunctor constraint and Identity.
    • Method Detail

      • apply

        default <CoP extends Profunctor<?,​?,​? extends P>,​CoF extends Functor<?,​? extends Identity<?>>,​FB extends Functor<B,​? extends CoF>,​FT extends Functor<T,​? extends CoF>,​PAFB extends Profunctor<A,​FB,​? extends CoP>,​PSFT extends Profunctor<S,​FT,​? extends CoP>> PSFT apply​(PAFB pafb)
        The polymorphic arrow between profunctors in this optic interface.
        Specified by:
        apply in interface Optic<P extends Profunctor<?,​?,​? extends P>,​Identity<?>,​S,​T,​A,​B>
        Type Parameters:
        CoP - the profunctor type constraint witnessed by the application of this optic
        CoF - the functor type constraint witnessed by the application of this optic
        FB - the covariant parameter type of the input profunctor
        FT - the covariant parameter type of the output profunctor
        PAFB - the full input type
        PSFT - the full output type
        Parameters:
        pafb - the input
        Returns:
        the output profunctor
      • andThen

        default <Z,​C> ProtoOptic<P,​S,​T,​Z,​C> andThen​(ProtoOptic<? super P,​A,​B,​Z,​C> f)
        Left-to-right composition of proto-optics. Requires compatibility between S and T.
        Type Parameters:
        Z - the new left side of the input profunctor
        C - the new right side's functor embedding of the input profunctor
        Parameters:
        f - the other proto-optic
        Returns:
        the composed proto-optic
      • compose

        default <R,​U> ProtoOptic<P,​R,​U,​A,​B> compose​(ProtoOptic<? super P,​R,​U,​S,​T> g)
        Right-to-Left composition of proto-optics. Requires compatibility between A and B.
        Type Parameters:
        R - the new left side of the output profunctor
        U - the new right side's functor embedding of the output profunctor
        Parameters:
        g - the other proto-optic
        Returns:
        the composed proto-optic
      • mapS

        default <R> ProtoOptic<P,​R,​T,​A,​B> mapS​(Fn1<? super R,​? extends S> fn)
        Contravariantly map S to R, yielding a new optic.
        Specified by:
        mapS in interface Optic<P extends Profunctor<?,​?,​? extends P>,​Identity<?>,​S,​T,​A,​B>
        Type Parameters:
        R - the new left side of the output profunctor
        Parameters:
        fn - the mapping function
        Returns:
        the new optic
      • mapT

        default <U> ProtoOptic<P,​S,​U,​A,​B> mapT​(Fn1<? super T,​? extends U> fn)
        Covariantly map T to U, yielding a new optic.
        Specified by:
        mapT in interface Optic<P extends Profunctor<?,​?,​? extends P>,​Identity<?>,​S,​T,​A,​B>
        Type Parameters:
        U - the new right side's functor embedding of the output profunctor
        Parameters:
        fn - the mapping function
        Returns:
        the new optic
      • mapA

        default <C> ProtoOptic<P,​S,​T,​C,​B> mapA​(Fn1<? super A,​? extends C> fn)
        Covariantly map A to C, yielding a new optic.
        Specified by:
        mapA in interface Optic<P extends Profunctor<?,​?,​? extends P>,​Identity<?>,​S,​T,​A,​B>
        Type Parameters:
        C - the new left side of the input profunctor
        Parameters:
        fn - the mapping function
        Returns:
        the new optic
      • mapB

        default <Z> ProtoOptic<P,​S,​T,​A,​Z> mapB​(Fn1<? super Z,​? extends B> fn)
        Contravariantly map B to Z, yielding a new optic.
        Specified by:
        mapB in interface Optic<P extends Profunctor<?,​?,​? extends P>,​Identity<?>,​S,​T,​A,​B>
        Type Parameters:
        Z - the new right side's functor embedding of the input profunctor
        Parameters:
        fn - the mapping function
        Returns:
        the new optic