Package fj.data.optic

Class Iso<S,​A>


  • public final class Iso<S,​A>
    extends PIso<S,​S,​A,​A>
    PIso when S = T and A = B
    • Field Detail

      • pIso

        final PIso<S,​S,​A,​A> pIso
    • Constructor Detail

      • Iso

        public Iso​(PIso<S,​S,​A,​A> pIso)
    • Method Detail

      • get

        public A get​(S s)
        Description copied from class: PIso
        get the target of a PIso
        Specified by:
        get in class PIso<S,​S,​A,​A>
      • reverseGet

        public S reverseGet​(A a)
        Description copied from class: PIso
        get the modified source of a PIso
        Specified by:
        reverseGet in class PIso<S,​S,​A,​A>
      • reverse

        public Iso<A,​S> reverse()
        Description copied from class: PIso
        reverse a PIso: the source becomes the target and the target becomes the source
        Specified by:
        reverse in class PIso<S,​S,​A,​A>
      • product

        public <S1,​A1> Iso<P2<S,​S1>,​P2<A,​A1>> product​(Iso<S1,​A1> other)
        pair two disjoint Iso
      • first

        public <C> Iso<P2<S,​C>,​P2<A,​C>> first()
        Overrides:
        first in class PIso<S,​S,​A,​A>
      • composePrism

        public <C> Prism<S,​C> composePrism​(Prism<A,​C> other)
        compose an Iso with a Prism
      • composeLens

        public <C> Lens<S,​C> composeLens​(Lens<A,​C> other)
        compose an Iso with a Lens
      • composeIso

        public <C> Iso<S,​C> composeIso​(Iso<A,​C> other)
        compose an Iso with an Iso
      • iso

        public static <S,​A> Iso<S,​A> iso​(F<S,​A> get,
                                                     F<A,​S> reverseGet)
        create an Iso using a pair of functions: one to get the target and one to get the source.
      • id

        public static <S> Iso<S,​S> id()
        create an Iso between any type and itself. id is the zero element of optics composition, for all optics o of type O (e.g. Lens, Iso, Prism, ...):
        
          o composeIso Iso.id == o
          Iso.id composeO o == o
         
        (replace composeO by composeLens, composeIso, composePrism, ...)