Package fj.data.optic
Class PTraversal<S,T,A,B>
- java.lang.Object
-
- fj.data.optic.PTraversal<S,T,A,B>
-
- Type Parameters:
S- the source of aPTraversalT- the modified source of aPTraversalA- the target of aPTraversalB- the modified target of aPTraversal
- Direct Known Subclasses:
Traversal
public abstract class PTraversal<S,T,A,B> extends java.lang.ObjectAPTraversalcan be seen as aPOptionalgeneralised to 0 to n targets where n can be infinite.PTraversalstands for Polymorphic Traversal as it set and modify methods change a typeAtoBandStoT.Traversalis aPTraversalrestricted to monomoprhic updates.
-
-
Constructor Summary
Constructors Constructor Description PTraversal()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description F<S,java.lang.Boolean>all(F<A,java.lang.Boolean> p)check if all targets satisfy the predicateFold<S,A>asFold()view aPTraversalas aFoldPSetter<S,T,A,B>asSetter()view aPTraversalas aPSetter<C> Fold<S,C>composeFold(Fold<A,C> other)compose aPTraversalwith aFold<C> Fold<S,C>composeFold(Getter<A,C> other)compose aPTraversalwith aGetter<C,D>
PTraversal<S,T,C,D>composeIso(PIso<A,B,C,D> other)compose aPTraversalwith aPIso<C,D>
PTraversal<S,T,C,D>composeLens(PLens<A,B,C,D> other)compose aPTraversalwith aPLens<C,D>
PTraversal<S,T,C,D>composeOptional(POptional<A,B,C,D> other)compose aPTraversalwith aPOptional<C,D>
PTraversal<S,T,C,D>composePrism(PPrism<A,B,C,D> other)compose aPTraversalwith aPPrism<C,D>
PSetter<S,T,C,D>composeSetter(PSetter<A,B,C,D> other)compose aPTraversalwith aPSetter<C,D>
PTraversal<S,T,C,D>composeTraversal(PTraversal<A,B,C,D> other)compose aPTraversalwith aPTraversalF<S,java.lang.Boolean>exist(F<A,java.lang.Boolean> p)check if at least one target satisfies the predicateF<S,Option<A>>find(F<A,java.lang.Boolean> p)find the first target of aPTraversalmatching the predicateF<S,A>fold(Monoid<A> m)combine all targets using a target'sMonoidabstract <M> F<S,M>foldMap(Monoid<M> monoid, F<A,M> f)map each target to aMonoidand combine the resultsprivate static <S,T,A,B>
PTraversal<S,T,A,B>fromCurried(PTraversal<S,F<B,T>,A,B> curriedTraversal, F<S,A> lastGet)List<A>getAll(S s)get all the targets of aPTraversalOption<A>headOption(S s)get the first target of aPTraversalF<S,T>modify(F<A,B> f)modify polymorphically the target of aPTraversalwith a functionabstract <L> F<S,Either<L,T>>modifyEitherF(F<A,Either<L,B>> f)modify polymorphically the target of aPTraversalwith an Applicative functionabstract <C> F<S,F<C,T>>modifyFunctionF(F<A,F<C,B>> f)modify polymorphically the target of aPTraversalwith an Applicative functionabstract F<S,IO<T>>modifyIOF(F<A,IO<B>> f)modify polymorphically the target of aPTraversalwith an Applicative functionabstract F<S,List<T>>modifyListF(F<A,List<B>> f)modify polymorphically the target of aPTraversalwith an Applicative functionabstract F<S,Option<T>>modifyOptionF(F<A,Option<B>> f)modify polymorphically the target of aPTraversalwith an Applicative functionabstract F<S,P1<T>>modifyP1F(F<A,P1<B>> f)modify polymorphically the target of aPTraversalwith an Applicative functionabstract F<S,Promise<T>>modifyPromiseF(F<A,Promise<B>> f)modify polymorphically the target of aPTraversalwith an Applicative functionabstract F<S,Stream<T>>modifyStreamF(F<A,Stream<B>> f)modify polymorphically the target of aPTraversalwith an Applicative functionabstract F<S,Trampoline<T>>modifyTrampolineF(F<A,Trampoline<B>> f)modify polymorphically the target of aPTraversalwith an Applicative functionabstract F<S,V2<T>>modifyV2F(F<A,V2<B>> f)modify polymorphically the target of aPTraversalwith an Applicative functionabstract <E> F<S,Validation<E,T>>modifyValidationF(Semigroup<E> s, F<A,Validation<E,B>> f)modify polymorphically the target of aPTraversalwith an Applicative functionstatic <S,T>
PTraversal<Either<S,S>,Either<T,T>,S,T>pCodiagonal()static <S,T>
PTraversal<S,T,S,T>pId()static <S,T,A,B>
PTraversal<S,T,A,B>pTraversal(F<S,A> get1, F<S,A> get2, F<S,A> get3, F<S,A> get4, F<S,A> get5, F<S,A> get6, F7<B,B,B,B,B,B,S,T> set)static <S,T,A,B>
PTraversal<S,T,A,B>pTraversal(F<S,A> get1, F<S,A> get2, F<S,A> get3, F<S,A> get4, F<S,A> get5, F6<B,B,B,B,B,S,T> set)static <S,T,A,B>
PTraversal<S,T,A,B>pTraversal(F<S,A> get1, F<S,A> get2, F<S,A> get3, F<S,A> get4, F5<B,B,B,B,S,T> set)static <S,T,A,B>
PTraversal<S,T,A,B>pTraversal(F<S,A> get1, F<S,A> get2, F<S,A> get3, F4<B,B,B,S,T> set)static <S,T,A,B>
PTraversal<S,T,A,B>pTraversal(F<S,A> get1, F<S,A> get2, F3<B,B,S,T> set)F<S,T>set(B b)set polymorphically the target of aPTraversalwith a value<S1,T1>
PTraversal<Either<S,S1>,Either<T,T1>,A,B>sum(PTraversal<S1,T1,A,B> other)join twoPTraversalwith the same target
-
-
-
Method Detail
-
modifyFunctionF
public abstract <C> F<S,F<C,T>> modifyFunctionF(F<A,F<C,B>> f)
modify polymorphically the target of aPTraversalwith an Applicative function
-
modifyEitherF
public abstract <L> F<S,Either<L,T>> modifyEitherF(F<A,Either<L,B>> f)
modify polymorphically the target of aPTraversalwith an Applicative function
-
modifyIOF
public abstract F<S,IO<T>> modifyIOF(F<A,IO<B>> f)
modify polymorphically the target of aPTraversalwith an Applicative function
-
modifyTrampolineF
public abstract F<S,Trampoline<T>> modifyTrampolineF(F<A,Trampoline<B>> f)
modify polymorphically the target of aPTraversalwith an Applicative function
-
modifyPromiseF
public abstract F<S,Promise<T>> modifyPromiseF(F<A,Promise<B>> f)
modify polymorphically the target of aPTraversalwith an Applicative function
-
modifyListF
public abstract F<S,List<T>> modifyListF(F<A,List<B>> f)
modify polymorphically the target of aPTraversalwith an Applicative function
-
modifyOptionF
public abstract F<S,Option<T>> modifyOptionF(F<A,Option<B>> f)
modify polymorphically the target of aPTraversalwith an Applicative function
-
modifyStreamF
public abstract F<S,Stream<T>> modifyStreamF(F<A,Stream<B>> f)
modify polymorphically the target of aPTraversalwith an Applicative function
-
modifyP1F
public abstract F<S,P1<T>> modifyP1F(F<A,P1<B>> f)
modify polymorphically the target of aPTraversalwith an Applicative function
-
modifyValidationF
public abstract <E> F<S,Validation<E,T>> modifyValidationF(Semigroup<E> s, F<A,Validation<E,B>> f)
modify polymorphically the target of aPTraversalwith an Applicative function
-
modifyV2F
public abstract F<S,V2<T>> modifyV2F(F<A,V2<B>> f)
modify polymorphically the target of aPTraversalwith an Applicative function
-
foldMap
public abstract <M> F<S,M> foldMap(Monoid<M> monoid, F<A,M> f)
map each target to aMonoidand combine the results
-
getAll
public final List<A> getAll(S s)
get all the targets of aPTraversal
-
find
public final F<S,Option<A>> find(F<A,java.lang.Boolean> p)
find the first target of aPTraversalmatching the predicate
-
headOption
public final Option<A> headOption(S s)
get the first target of aPTraversal
-
exist
public final F<S,java.lang.Boolean> exist(F<A,java.lang.Boolean> p)
check if at least one target satisfies the predicate
-
all
public final F<S,java.lang.Boolean> all(F<A,java.lang.Boolean> p)
check if all targets satisfy the predicate
-
modify
public final F<S,T> modify(F<A,B> f)
modify polymorphically the target of aPTraversalwith a function
-
set
public final F<S,T> set(B b)
set polymorphically the target of aPTraversalwith a value
-
sum
public final <S1,T1> PTraversal<Either<S,S1>,Either<T,T1>,A,B> sum(PTraversal<S1,T1,A,B> other)
join twoPTraversalwith the same target
-
composeFold
public final <C> Fold<S,C> composeFold(Fold<A,C> other)
compose aPTraversalwith aFold
-
composeFold
public final <C> Fold<S,C> composeFold(Getter<A,C> other)
compose aPTraversalwith aGetter
-
composeSetter
public final <C,D> PSetter<S,T,C,D> composeSetter(PSetter<A,B,C,D> other)
compose aPTraversalwith aPSetter
-
composeTraversal
public final <C,D> PTraversal<S,T,C,D> composeTraversal(PTraversal<A,B,C,D> other)
compose aPTraversalwith aPTraversal
-
composeOptional
public final <C,D> PTraversal<S,T,C,D> composeOptional(POptional<A,B,C,D> other)
compose aPTraversalwith aPOptional
-
composePrism
public final <C,D> PTraversal<S,T,C,D> composePrism(PPrism<A,B,C,D> other)
compose aPTraversalwith aPPrism
-
composeLens
public final <C,D> PTraversal<S,T,C,D> composeLens(PLens<A,B,C,D> other)
compose aPTraversalwith aPLens
-
composeIso
public final <C,D> PTraversal<S,T,C,D> composeIso(PIso<A,B,C,D> other)
compose aPTraversalwith aPIso
-
asFold
public final Fold<S,A> asFold()
view aPTraversalas aFold
-
pId
public static <S,T> PTraversal<S,T,S,T> pId()
-
pCodiagonal
public static <S,T> PTraversal<Either<S,S>,Either<T,T>,S,T> pCodiagonal()
-
pTraversal
public static <S,T,A,B> PTraversal<S,T,A,B> pTraversal(F<S,A> get1, F<S,A> get2, F3<B,B,S,T> set)
-
pTraversal
public static <S,T,A,B> PTraversal<S,T,A,B> pTraversal(F<S,A> get1, F<S,A> get2, F<S,A> get3, F4<B,B,B,S,T> set)
-
pTraversal
public static <S,T,A,B> PTraversal<S,T,A,B> pTraversal(F<S,A> get1, F<S,A> get2, F<S,A> get3, F<S,A> get4, F5<B,B,B,B,S,T> set)
-
pTraversal
public static <S,T,A,B> PTraversal<S,T,A,B> pTraversal(F<S,A> get1, F<S,A> get2, F<S,A> get3, F<S,A> get4, F<S,A> get5, F6<B,B,B,B,B,S,T> set)
-
pTraversal
public static <S,T,A,B> PTraversal<S,T,A,B> pTraversal(F<S,A> get1, F<S,A> get2, F<S,A> get3, F<S,A> get4, F<S,A> get5, F<S,A> get6, F7<B,B,B,B,B,B,S,T> set)
-
fromCurried
private static <S,T,A,B> PTraversal<S,T,A,B> fromCurried(PTraversal<S,F<B,T>,A,B> curriedTraversal, F<S,A> lastGet)
-
-