# PEvery

interface PEvery<S, T, A, B> : PTraversal<S, T, A, B> , Fold<S, A> , PSetter<S, T, A, B>

Composition of Fold and Traversal It combines their powers

object Companion

## Functions

open fun all(source: S, predicate: (A) -> Boolean): Boolean

Check if all targets satisfy the predicate

open fun any(source: S, predicate: (A) -> Boolean): Boolean

Returns `true` if at least one focus matches the given predicate.

open infix fun <C> choice(other: Fold<C, A>): Fold<Either<S, C>, A>

Join two Fold with the same target

open infix fun <U, V> choice(other: PSetter<U, V, A, B>): PSetter<Either<S, U>, Either<T, V>, A, B>

Join two PSetter with the same target

open fun <U, V> choice(other: PTraversal<U, V, A, B>): PTraversal<Either<S, U>, Either<T, V>, A, B>
open fun combineAll(M: Monoid<A>, source: S): A

Alias for fold.

open infix fun <C> compose(other: Fold<in A, out C>): Fold<S, C>

Compose a Fold with a Fold

open infix fun <C, D> compose(other: PEvery<in A, out B, out C, in D>): PEvery<S, T, C, D>

Compose a PEvery with a PEvery

open infix fun <C, D> compose(other: PSetter<in A, out B, out C, in D>): PSetter<S, T, C, D>

Compose a PSetter with a PSetter

open infix fun <C, D> compose(other: PTraversal<in A, out B, out C, in D>): PTraversal<S, T, C, D>

Compose a PTraversal with a PTraversal

open fun exists(source: S, predicate: (A) -> Boolean): Boolean

Check whether at least one element satisfies the predicate.

open fun findOrNull(source: S, predicate: (A) -> Boolean): A?

Find the first element matching the predicate, if one exists.

open fun firstOrNull(source: S): A?

Get the first target or null

open fun fold(M: Monoid<A>, source: S): A

Fold using the given Monoid instance.

abstract override fun <R> foldMap(    M: Monoid<R>,     source: S,     map: (A) -> R): R

Map each target to a type R and use a Monoid to fold the results

open fun getAll(source: S): List<A>

Get all targets of the Fold

open fun isEmpty(source: S): Boolean

Check if there is no target

open fun isNotEmpty(source: S): Boolean

Check if there is at least one target

open fun lastOrNull(source: S): A?

Get the last target or null

open fun <C> left(): Fold<Either<S, C>, Either<A, C>>

Create a sum of the Fold and a type C

open fun lift(map: (A) -> B): (S) -> T

Lift a function map: `(A) -> B to the context of `S`: `(S) -> T`

abstract override fun modify(source: S, map: (A) -> B): T

Modify polymorphically the focus of a PSetter with a function map.

open operator fun <C> plus(other: Fold<in A, out C>): Fold<S, C>
open operator fun <C, D> plus(other: PEvery<in A, out B, out C, in D>): PEvery<S, T, C, D>
open operator fun <C, D> plus(other: PSetter<in A, out B, out C, in D>): PSetter<S, T, C, D>
open operator fun <C, D> plus(other: PTraversal<in A, out B, out C, in D>): PTraversal<S, T, C, D>
open fun <C> right(): Fold<Either<C, S>, Either<C, A>>

Create a sum of a type C and the Fold

open fun set(source: S, focus: B): T

Set polymorphically the focus of a PSetter with a value b.

open fun size(source: S): Int

Calculate the number of targets

## Properties

open override val <U, V> PLens<U, V, S, T>.every: PEvery<U, V, A, B>

DSL to compose Every with a Lens for a structure S to see all its foci A

open override val <U, V> PIso<U, V, S, T>.every: PEvery<U, V, A, B>

DSL to compose Every with a Iso for a structure S to see all its foci A

open override val <U, V> PPrism<U, V, S, T>.every: PEvery<U, V, A, B>

DSL to compose Every with a Prism for a structure S to see all its foci A

open override val <U, V> POptional<U, V, S, T>.every: PEvery<U, V, A, B>

DSL to compose Every with a Optional for a structure S to see all its foci A

open override val <U, V> PSetter<U, V, S, T>.every: PSetter<U, V, A, B>

DSL to compose Every with a Setter for a structure S to see all its foci A

open override val <U, V> PTraversal<U, V, S, T>.every: PTraversal<U, V, A, B>

DSL to compose Every with a Traversal for a structure S to see all its foci A

open val <U, V> PEvery<U, V, S, T>.every: PTraversal<U, V, A, B>

DSL to compose Traversal with a PEvery for a structure S to see all its foci A