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 aPIso
T
- the modified source of aPIso
A
- the target of aPIso
B
- 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 aPIso
as aPTraversal
composeFold
(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 aPIso
with aPTraversal
first()
abstract A
get the target of aPIso
modify polymorphically the target of aPIso
with a functionmodifyEitherF
(F<A, Either<L, B>> f) modify polymorphically the target of aPIso
with an Applicative functionmodifyFunctionF
(F<A, F<C, B>> f) modify polymorphically the target of aPIso
with an Applicative functionmodify polymorphically the target of aPIso
with an Applicative functionmodifyListF
(F<A, List<B>> f) modify polymorphically the target of aPIso
with an Applicative functionmodifyOptionF
(F<A, Option<B>> f) modify polymorphically the target of aPIso
with an Applicative functionmodify polymorphically the target of aPIso
with an Applicative functionmodifyPromiseF
(F<A, Promise<B>> f) modify polymorphically the target of aPIso
with an Applicative functionmodifyStreamF
(F<A, Stream<B>> f) modify polymorphically the target of aPIso
with an Applicative functionfinal F
<S, Trampoline<T>> modifyTrampolineF
(F<A, Trampoline<B>> f) modify polymorphically the target of aPIso
with an Applicative functionmodify polymorphically the target of aPIso
with an Applicative functionfinal <E> F
<S, Validation<E, T>> modifyValidationF
(F<A, Validation<E, B>> f) modify polymorphically the target of aPIso
with an Applicative functionstatic <S,
T> PIso <S, T, S, T> pId()
create aPIso
between any type and itself.static <S,
T, A, B>
PIso<S, T, A, B> create aPIso
using a pair of functions: one to get the target and one to get the source.pair two disjointPIso
reverse()
reverse aPIso
: the source becomes the target and the target becomes the sourceabstract T
reverseGet
(B b) get the modified source of aPIso
second()
set polymorphically the target of aPIso
with 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 aPIso
with an Applicative function -
modifyEitherF
modify polymorphically the target of aPIso
with an Applicative function -
modifyIOF
modify polymorphically the target of aPIso
with an Applicative function -
modifyTrampolineF
modify polymorphically the target of aPIso
with an Applicative function -
modifyPromiseF
modify polymorphically the target of aPIso
with an Applicative function -
modifyListF
modify polymorphically the target of aPIso
with an Applicative function -
modifyOptionF
modify polymorphically the target of aPIso
with an Applicative function -
modifyStreamF
modify polymorphically the target of aPIso
with an Applicative function -
modifyP1F
modify polymorphically the target of aPIso
with an Applicative function -
modifyValidationF
modify polymorphically the target of aPIso
with an Applicative function -
modifyV2F
modify polymorphically the target of aPIso
with an Applicative function -
modify
modify polymorphically the target of aPIso
with a function -
set
set polymorphically the target of aPIso
with 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 aPIso
with aPTraversal
-
composeOptional
-
composePrism
-
composeLens
-
composeIso
-
asFold
-
asGetter
-
asSetter
-
asTraversal
view aPIso
as aPTraversal
-
asOptional
-
asPrism
-
asLens
-
pIso
create aPIso
using a pair of functions: one to get the target and one to get the source. -
pId
create aPIso
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, ...):
(replace composeO by composeLens, composeIso, composePrism, ...)o composeIso Iso.id == o Iso.id composeO o == o
-