Package fj.data.optic

Class Fold<S,​A>

    • Constructor Detail

      • Fold

        public Fold()
    • Method Detail

      • foldMap

        public abstract <M> F<S,​M> foldMap​(Monoid<M> m,
                                                 F<A,​M> f)
        map each target to a Monoid and combine the results underlying representation of Fold, all Fold methods are defined in terms of foldMap
      • fold

        public final F<S,​A> fold​(Monoid<A> m)
        combine all targets using a target's Monoid
      • getAll

        public final List<A> getAll​(S s)
        get all the targets of a Fold TODO: Shall it return a Stream as there might be an infinite number of targets?
      • find

        public final F<S,​Option<A>> find​(F<A,​java.lang.Boolean> p)
        find the first target of a Fold matching the predicate
      • headOption

        public final Option<A> headOption​(S s)
        get the first target of a Fold
      • 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
      • sum

        public final <S1> Fold<Either<S,​S1>,​A> sum​(Fold<S1,​A> other)
        join two Fold with the same target
      • composeFold

        public final <B> Fold<S,​B> composeFold​(Fold<A,​B> other)
        compose a Fold with a Fold
      • composeGetter

        public final <C> Fold<S,​C> composeGetter​(Getter<A,​C> other)
        compose a Fold with a Getter
      • composeOptional

        public final <B,​C,​D> Fold<S,​C> composeOptional​(POptional<A,​B,​C,​D> other)
        compose a Fold with a POptional
      • composePrism

        public final <B,​C,​D> Fold<S,​C> composePrism​(PPrism<A,​B,​C,​D> other)
        compose a Fold with a PPrism
      • composeLens

        public final <B,​C,​D> Fold<S,​C> composeLens​(PLens<A,​B,​C,​D> other)
        compose a Fold with a PLens
      • composeIso

        public final <B,​C,​D> Fold<S,​C> composeIso​(PIso<A,​B,​C,​D> other)
        compose a Fold with a PIso
      • id

        public static <A> Fold<A,​A> id()
      • codiagonal

        public static <A> Fold<Either<A,​A>,​A> codiagonal()