Package fj.data.optic
Class POptional<S,T,A,B>
java.lang.Object
fj.data.optic.POptional<S,T,A,B>
- Type Parameters:
S- the source of aPOptionalT- the modified source of aPOptionalA- the target of aPOptionalB- the modified target of aPOptional
- Direct Known Subclasses:
Optional
A
POptional can be seen as a pair of functions:getOrModify: S => T \/ Aset : (B, S) => T
A POptional could also be defined as a weaker PLens and weaker PPrism
POptional stands for Polymorphic Optional as it set and modify methods change a type A to B and S to T.
Optional is a POptional restricted to monomoprhic updates: type Optional[S, A] = POptional[S, S, A, A]
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasFold()asSetter()PTraversal<S, T, A, B> view aPOptionalas 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 aPOptionalwith aPTraversalfirst()get the target of aPOptionalor nothing if there is no targetgetOrModify(S s) get the target of aPOptionalor modify the source in case there is no targetfinal booleanisMatching(S s) check if aPOptionalhas a targetmodify polymorphically the target of aPOptionalwith a functionmodifyEitherF(F<A, Either<L, B>> f) modify polymorphically the target of aPOptionalwith an Applicative functionmodifyFunctionF(F<A, F<C, B>> f) modify polymorphically the target of aPOptionalwith an Applicative functionmodify polymorphically the target of aPOptionalwith an Applicative functionmodifyListF(F<A, List<B>> f) modify polymorphically the target of aPOptionalwith an Applicative functionmodifyOption(F<A, B> f) modify polymorphically the target of aPOptionalwith a function.modifyOptionF(F<A, Option<B>> f) modify polymorphically the target of aPOptionalwith an Applicative functionmodify polymorphically the target of aPOptionalwith an Applicative functionmodifyPromiseF(F<A, Promise<B>> f) modify polymorphically the target of aPOptionalwith an Applicative functionmodifyStreamF(F<A, Stream<B>> f) modify polymorphically the target of aPOptionalwith an Applicative functionabstract F<S, Trampoline<T>> modifyTrampolineF(F<A, Trampoline<B>> f) modify polymorphically the target of aPOptionalwith an Applicative functionmodify polymorphically the target of aPOptionalwith an Applicative functionabstract <E> F<S, Validation<E, T>> modifyValidationF(F<A, Validation<E, B>> f) modify polymorphically the target of aPOptionalwith an Applicative functionstatic <S,T> POptional <S, T, S, T> pId()static <S,T, A, B>
POptional<S, T, A, B> create aPOptionalusing the canonical functions: getOrModify and setsecond()get the modified source of aPOptionalset polymorphically the target of aPOptionalwith a value.join twoPOptionalwith the same target
-
Constructor Details
-
POptional
POptional()
-
-
Method Details
-
getOrModify
get the target of aPOptionalor modify the source in case there is no target -
set
get the modified source of aPOptional -
getOption
get the target of aPOptionalor nothing if there is no target -
modifyFunctionF
modify polymorphically the target of aPOptionalwith an Applicative function -
modifyEitherF
modify polymorphically the target of aPOptionalwith an Applicative function -
modifyIOF
modify polymorphically the target of aPOptionalwith an Applicative function -
modifyTrampolineF
modify polymorphically the target of aPOptionalwith an Applicative function -
modifyPromiseF
modify polymorphically the target of aPOptionalwith an Applicative function -
modifyListF
modify polymorphically the target of aPOptionalwith an Applicative function -
modifyOptionF
modify polymorphically the target of aPOptionalwith an Applicative function -
modifyStreamF
modify polymorphically the target of aPOptionalwith an Applicative function -
modifyP1F
modify polymorphically the target of aPOptionalwith an Applicative function -
modifyValidationF
modify polymorphically the target of aPOptionalwith an Applicative function -
modifyV2F
modify polymorphically the target of aPOptionalwith an Applicative function -
modify
modify polymorphically the target of aPOptionalwith a function -
modifyOption
-
setOption
-
isMatching
check if aPOptionalhas a target -
sum
join twoPOptionalwith the same target -
first
-
second
-
composeFold
-
composeGetter
-
composeSetter
-
composeTraversal
compose aPOptionalwith aPTraversal -
composeOptional
-
composePrism
-
composeLens
-
composeIso
-
asFold
-
asSetter
-
asTraversal
view aPOptionalas aPTraversal -
pId
-
pOptional
public static <S,T, POptional<S,A, B> T, pOptionalA, B> (F<S, Either<T, A>> getOrModify, F<B, F<S, T>> set) create aPOptionalusing the canonical functions: getOrModify and set
-