Class PPrism<S,T,A,B>
java.lang.Object
fj.data.optic.PPrism<S,T,A,B>
- Type Parameters:
S- the source of aPPrismT- the modified source of aPPrismA- the target of aPPrismB- the modified target of aPPrism
- Direct Known Subclasses:
Prism
A
PPrism can be seen as a pair of functions:getOrModify: S => T \/ AreverseGet : B => T
A PPrism could also be defined as a weaker PIso where get can fail.
Typically a PPrism or Prism encodes the relation between a Sum or CoProduct type (e.g. sealed trait) and one
of it is element.
PPrism stands for Polymorphic Prism as it set and modify methods change a type A to B and S to T.
Prism is a PPrism where the type of target cannot be modified.
A PPrism is also a valid Fold, POptional, PTraversal and PSetter-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasFold()asSetter()PTraversal<S, T, A, B> view aPPrismas 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 aPPrismwith aPTraversalget the target of aPPrismor nothing if there is no targetgetOrModify(S s) get the target of aPPrismor modify the source in case there is no targetfinal booleanisMatching(S s) check if aPPrismhas a targetmodify polymorphically the target of aPPrismwith a functionmodifyEitherF(F<A, Either<L, B>> f) modify polymorphically the target of aPPrismwith an Applicative functionmodifyFunctionF(F<A, F<C, B>> f) modify polymorphically the target of aPPrismwith an Applicative functionmodify polymorphically the target of aPPrismwith an Applicative functionmodifyListF(F<A, List<B>> f) modify polymorphically the target of aPPrismwith an Applicative functionmodifyOption(F<A, B> f) modify polymorphically the target of aPPrismwith a function.modifyOptionF(F<A, Option<B>> f) modify polymorphically the target of aPPrismwith an Applicative functionmodify polymorphically the target of aPPrismwith an Applicative functionmodifyPromiseF(F<A, Promise<B>> f) modify polymorphically the target of aPPrismwith an Applicative functionmodifyStreamF(F<A, Stream<B>> f) modify polymorphically the target of aPPrismwith an Applicative functionfinal F<S, Trampoline<T>> modifyTrampolineF(F<A, Trampoline<B>> f) modify polymorphically the target of aPPrismwith an Applicative functionmodify polymorphically the target of aPPrismwith an Applicative functionfinal <E> F<S, Validation<E, T>> modifyValidationF(F<A, Validation<E, B>> f) modify polymorphically the target of aPPrismwith an Applicative functionstatic <S,T> PPrism <S, T, S, T> pId()static <S,T, A, B> PPrism <S, T, A, B> create aPPrismusing the canonical functions: getOrModify and reverseGetre()abstract TreverseGet(B b) get the modified source of aPPrismset polymorphically the target of aPPrismwith a valueset polymorphically the target of aPPrismwith a value.
-
Constructor Details
-
PPrism
PPrism()
-
-
Method Details
-
getOrModify
-
reverseGet
-
getOption
-
modifyFunctionF
-
modifyEitherF
-
modifyIOF
-
modifyTrampolineF
modify polymorphically the target of aPPrismwith an Applicative function -
modifyPromiseF
-
modifyListF
-
modifyOptionF
-
modifyStreamF
-
modifyP1F
-
modifyValidationF
modify polymorphically the target of aPPrismwith an Applicative function -
modifyV2F
-
modify
-
modifyOption
-
set
-
setOption
-
isMatching
-
re
-
composeFold
-
composeGetter
-
composeSetter
-
composeTraversal
compose aPPrismwith aPTraversal -
composeOptional
-
composeLens
-
composePrism
-
composeIso
-
asFold
-
asSetter
-
asTraversal
view aPPrismas aPTraversal -
asOptional
-
pId
-
pPrism
-