Package fj.data.optic
Class PLens<S,T,A,B>
java.lang.Object
fj.data.optic.PLens<S,T,A,B>
- Type Parameters:
S
- the source of aPLens
T
- the modified source of aPLens
A
- the target of aPLens
B
- the modified target of aPLens
- Direct Known Subclasses:
Lens
A
PLens
can be seen as a pair of functions:get: S => A
i.e. from anS
, we can extract anA
set: (B, S) => T
i.e. if we replace anA
by aB
in anS
, we obtain aT
A PLens
could also be defined as a weaker PIso
where set requires an additional parameter than reverseGet.
PLens
stands for Polymorphic Lens as it set and modify methods change a type A
to B
and S
to T
. Lens
is a PLens
restricted to monomoprhic updates.
A PLens
is also a valid Getter
, Fold
, POptional
, PTraversal
and PSetter
Typically a PLens
or Lens
can be defined between a Product (e.g. case class, tuple, HList) and one of it is
component.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasFold()
asGetter()
asSetter()
PTraversal
<S, T, A, B> view aPLens
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 aPLens
with aPTraversal
abstract A
get the target of aPLens
modify polymorphically the target of aPLens
using a functionmodifyEitherF
(F<A, Either<L, B>> f) modify polymorphically the target of aPLens
with an Applicative functionmodifyFunctionF
(F<A, F<C, B>> f) modify polymorphically the target of aPLens
with an Applicative functionmodify polymorphically the target of aPLens
with an Applicative functionmodifyListF
(F<A, List<B>> f) modify polymorphically the target of aPLens
with an Applicative functionmodifyOptionF
(F<A, Option<B>> f) modify polymorphically the target of aPLens
with an Applicative functionmodify polymorphically the target of aPLens
with an Applicative functionmodifyPromiseF
(F<A, Promise<B>> f) modify polymorphically the target of aPLens
with an Applicative functionmodifyStreamF
(F<A, Stream<B>> f) modify polymorphically the target of aPLens
with an Applicative functionabstract F
<S, Trampoline<T>> modifyTrampolineF
(F<A, Trampoline<B>> f) modify polymorphically the target of aPLens
with an Applicative functionmodify polymorphically the target of aPLens
with an Applicative functionabstract <E> F
<S, Validation<E, T>> modifyValidationF
(F<A, Validation<E, B>> f) modify polymorphically the target of aPLens
with an Applicative functionstatic <S,
T> PLens <S, T, S, T> pId()
static <S,
T, A, B>
PLens<S, T, A, B> create aPLens
using a pair of functions: one to get the target, one to set the target.set polymorphically the target of aPLens
using a functionjoin twoPLens
with the same target
-
Constructor Details
-
PLens
PLens()
-
-
Method Details
-
get
get the target of aPLens
-
set
set polymorphically the target of aPLens
using a function -
modifyFunctionF
modify polymorphically the target of aPLens
with an Applicative function -
modifyEitherF
modify polymorphically the target of aPLens
with an Applicative function -
modifyIOF
modify polymorphically the target of aPLens
with an Applicative function -
modifyTrampolineF
modify polymorphically the target of aPLens
with an Applicative function -
modifyPromiseF
modify polymorphically the target of aPLens
with an Applicative function -
modifyListF
modify polymorphically the target of aPLens
with an Applicative function -
modifyOptionF
modify polymorphically the target of aPLens
with an Applicative function -
modifyStreamF
modify polymorphically the target of aPLens
with an Applicative function -
modifyP1F
modify polymorphically the target of aPLens
with an Applicative function -
modifyValidationF
modify polymorphically the target of aPLens
with an Applicative function -
modifyV2F
modify polymorphically the target of aPLens
with an Applicative function -
modify
modify polymorphically the target of aPLens
using a function -
sum
join twoPLens
with the same target -
composeFold
-
composeGetter
-
composeSetter
-
composeTraversal
compose aPLens
with aPTraversal
-
composeOptional
-
composePrism
-
composeLens
-
composeIso
-
asFold
-
asGetter
-
asSetter
-
asTraversal
view aPLens
as aPTraversal
-
asOptional
-
pId
-
pLens
create aPLens
using a pair of functions: one to get the target, one to set the target.
-