Class PIso<S,T,A,B>
java.lang.Object
fj.data.optic.PIso<S,T,A,B>
- Type Parameters:
S- the source of aPIsoT- the modified source of aPIsoA- the target of aPIsoB- the modified target of aPIso
- Direct Known Subclasses:
Iso
A
PIso defines an isomorphism between types S, A and B, T:
get reverse.get
--------------------> -------------------->
S A T B
<-------------------- <--------------------
reverse.reverseGet reverseGet
In addition, if f and g forms an isomorphism between A and B, i.e. if f . g = id and g . f = id, then a PIso
defines an isomorphism between S and T:
S T S T
| | | |
| | | |
get | | reverseGet reverse.reverseGet | | reverse.get
| | | |
| f | | g |
A --------> B A <-------- B
A PIso is also a valid Getter, Fold, PLens, PPrism, POptional,
PTraversal and PSetter-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasFold()asGetter()asLens()asPrism()asSetter()PTraversal<S, T, A, B> view aPIsoas aPTraversalcomposeFold(Fold<A, C> other) composeGetter(Getter<A, C> other) composeIso(PIso<A, B, C, D> other) composeLens(PLens<A, B, C, D> other) composeOptional(POptional<A, B, C, D> other) composePrism(PPrism<A, B, C, D> other) composeSetter(PSetter<A, B, C, D> other) final <C,D> PTraversal <S, T, C, D> composeTraversal(PTraversal<A, B, C, D> other) compose aPIsowith aPTraversalfirst()abstract Aget the target of aPIsomodify polymorphically the target of aPIsowith a functionmodifyEitherF(F<A, Either<L, B>> f) modify polymorphically the target of aPIsowith an Applicative functionmodifyFunctionF(F<A, F<C, B>> f) modify polymorphically the target of aPIsowith an Applicative functionmodify polymorphically the target of aPIsowith an Applicative functionmodifyListF(F<A, List<B>> f) modify polymorphically the target of aPIsowith an Applicative functionmodifyOptionF(F<A, Option<B>> f) modify polymorphically the target of aPIsowith an Applicative functionmodify polymorphically the target of aPIsowith an Applicative functionmodifyPromiseF(F<A, Promise<B>> f) modify polymorphically the target of aPIsowith an Applicative functionmodifyStreamF(F<A, Stream<B>> f) modify polymorphically the target of aPIsowith an Applicative functionfinal F<S, Trampoline<T>> modifyTrampolineF(F<A, Trampoline<B>> f) modify polymorphically the target of aPIsowith an Applicative functionmodify polymorphically the target of aPIsowith an Applicative functionfinal <E> F<S, Validation<E, T>> modifyValidationF(F<A, Validation<E, B>> f) modify polymorphically the target of aPIsowith an Applicative functionstatic <S,T> PIso <S, T, S, T> pId()create aPIsobetween any type and itself.static <S,T, A, B> PIso <S, T, A, B> create aPIsousing a pair of functions: one to get the target and one to get the source.pair two disjointPIsoreverse()reverse aPIso: the source becomes the target and the target becomes the sourceabstract TreverseGet(B b) get the modified source of aPIsosecond()set polymorphically the target of aPIsowith a value
-
Constructor Details
-
PIso
PIso()
-
-
Method Details
-
get
-
reverseGet
-
reverse
-
modifyFunctionF
-
modifyEitherF
-
modifyIOF
-
modifyTrampolineF
modify polymorphically the target of aPIsowith an Applicative function -
modifyPromiseF
-
modifyListF
-
modifyOptionF
-
modifyStreamF
-
modifyP1F
-
modifyValidationF
modify polymorphically the target of aPIsowith an Applicative function -
modifyV2F
-
modify
-
set
-
product
-
first
-
second
-
composeFold
-
composeGetter
-
composeSetter
-
composeTraversal
compose aPIsowith aPTraversal -
composeOptional
-
composePrism
-
composeLens
-
composeIso
-
asFold
-
asGetter
-
asSetter
-
asTraversal
view aPIsoas aPTraversal -
asOptional
-
asPrism
-
asLens
-
pIso
-
pId
-