Package fj.data.optic
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
get the target of aPIso -
reverseGet
get the modified source of aPIso -
reverse
reverse aPIso: the source becomes the target and the target becomes the source -
modifyFunctionF
modify polymorphically the target of aPIsowith an Applicative function -
modifyEitherF
modify polymorphically the target of aPIsowith an Applicative function -
modifyIOF
modify polymorphically the target of aPIsowith an Applicative function -
modifyTrampolineF
modify polymorphically the target of aPIsowith an Applicative function -
modifyPromiseF
modify polymorphically the target of aPIsowith an Applicative function -
modifyListF
modify polymorphically the target of aPIsowith an Applicative function -
modifyOptionF
modify polymorphically the target of aPIsowith an Applicative function -
modifyStreamF
modify polymorphically the target of aPIsowith an Applicative function -
modifyP1F
modify polymorphically the target of aPIsowith an Applicative function -
modifyValidationF
modify polymorphically the target of aPIsowith an Applicative function -
modifyV2F
modify polymorphically the target of aPIsowith an Applicative function -
modify
modify polymorphically the target of aPIsowith a function -
set
set polymorphically the target of aPIsowith a value -
product
public final <S1,T1, PIso<P2<S,A1, B1> S1>, productP2<T, T1>, P2<A, A1>, P2<B, B1>> (PIso<S1, T1, A1, B1> other) pair two disjointPIso -
first
-
second
-
composeFold
-
composeGetter
-
composeSetter
-
composeTraversal
compose aPIsowith aPTraversal -
composeOptional
-
composePrism
-
composeLens
-
composeIso
-
asFold
-
asGetter
-
asSetter
-
asTraversal
view aPIsoas aPTraversal -
asOptional
-
asPrism
-
asLens
-
pIso
create aPIsousing a pair of functions: one to get the target and one to get the source. -
pId
create aPIsobetween any type and itself. id is the zero element of optics composition, for all optics o of type O (e.g. Lens, Iso, Prism, ...):
(replace composeO by composeLens, composeIso, composePrism, ...)o composeIso Iso.id == o Iso.id composeO o == o
-