Class PLens<S,T,A,B>
java.lang.Object
fj.data.optic.PLens<S,T,A,B>
- Type Parameters:
S- the source of aPLensT- the modified source of aPLensA- the target of aPLensB- the modified target of aPLens
- Direct Known Subclasses:
Lens
A
PLens can be seen as a pair of functions:get: S => Ai.e. from anS, we can extract anAset: (B, S) => Ti.e. if we replace anAby aBin 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 aPLensas 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 aPLenswith aPTraversalabstract Aget the target of aPLensmodify polymorphically the target of aPLensusing a functionmodifyEitherF(F<A, Either<L, B>> f) modify polymorphically the target of aPLenswith an Applicative functionmodifyFunctionF(F<A, F<C, B>> f) modify polymorphically the target of aPLenswith an Applicative functionmodify polymorphically the target of aPLenswith an Applicative functionmodifyListF(F<A, List<B>> f) modify polymorphically the target of aPLenswith an Applicative functionmodifyOptionF(F<A, Option<B>> f) modify polymorphically the target of aPLenswith an Applicative functionmodify polymorphically the target of aPLenswith an Applicative functionmodifyPromiseF(F<A, Promise<B>> f) modify polymorphically the target of aPLenswith an Applicative functionmodifyStreamF(F<A, Stream<B>> f) modify polymorphically the target of aPLenswith an Applicative functionabstract F<S, Trampoline<T>> modifyTrampolineF(F<A, Trampoline<B>> f) modify polymorphically the target of aPLenswith an Applicative functionmodify polymorphically the target of aPLenswith an Applicative functionabstract <E> F<S, Validation<E, T>> modifyValidationF(F<A, Validation<E, B>> f) modify polymorphically the target of aPLenswith an Applicative functionstatic <S,T> PLens <S, T, S, T> pId()static <S,T, A, B> PLens <S, T, A, B> create aPLensusing a pair of functions: one to get the target, one to set the target.set polymorphically the target of aPLensusing a functionjoin twoPLenswith the same target
-
Constructor Details
-
PLens
PLens()
-
-
Method Details
-
get
-
set
-
modifyFunctionF
-
modifyEitherF
-
modifyIOF
-
modifyTrampolineF
modify polymorphically the target of aPLenswith an Applicative function -
modifyPromiseF
-
modifyListF
-
modifyOptionF
-
modifyStreamF
-
modifyP1F
-
modifyValidationF
modify polymorphically the target of aPLenswith an Applicative function -
modifyV2F
-
modify
-
sum
-
composeFold
-
composeGetter
-
composeSetter
-
composeTraversal
compose aPLenswith aPTraversal -
composeOptional
-
composePrism
-
composeLens
-
composeIso
-
asFold
-
asGetter
-
asSetter
-
asTraversal
view aPLensas aPTraversal -
asOptional
-
pId
-
pLens
-