trait PTraversal[S, T, A, B] extends PSetter[S, T, A, B] with Fold[S, A]

A PTraversal can be seen as a POptional generalised to 0 to n targets where n can be infinite.

PTraversal stands for Polymorphic Traversal as it replace and modify methods change a type A to B and S to T. Traversal is a type alias for PTraversal restricted to monomorphic updates:

type Traversal[S, A] = PTraversal[S, S, A, A]
S

the source of a PTraversal

T

the modified source of a PTraversal

A

the target of a PTraversal

B

the modified target of a PTraversal

Self Type
PTraversal[S, T, A, B]
Source
Traversal.scala
See also

monocle.law.TraversalLaws

Linear Supertypes
Fold[S, A], PSetter[S, T, A, B], Serializable, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. PTraversal
  2. Fold
  3. PSetter
  4. Serializable
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Abstract Value Members

  1. abstract def modifyA[F[_]](f: (A) => F[B])(s: S)(implicit arg0: Applicative[F]): F[T]

    modify polymorphically the target of a PTraversal with an Applicative function all traversal methods are written in terms of modifyA

Concrete Value Members

  1. def all(p: (A) => Boolean): (S) => Boolean

    check if all targets satisfy the predicate

    check if all targets satisfy the predicate

    Definition Classes
    Fold
  2. def andThen[C, D](other: PTraversal[A, B, C, D]): PTraversal[S, T, C, D]

    compose a PTraversal with another PTraversal

  3. def andThen[B](other: Fold[A, B]): Fold[S, B]

    compose a Fold with another Fold

    compose a Fold with another Fold

    Definition Classes
    Fold
  4. def andThen[C, D](other: PSetter[A, B, C, D]): PSetter[S, T, C, D]

    compose a PSetter with another PSetter

    compose a PSetter with another PSetter

    Definition Classes
    PSetter
  5. def asFold: Fold[S, A]

    view a PTraversal as a Fold

  6. def asSetter: PSetter[S, T, A, B]

    view a PTraversal as a PSetter

  7. def exist(p: (A) => Boolean): (S) => Boolean

    check if at least one target satisfies the predicate

    check if at least one target satisfies the predicate

    Definition Classes
    Fold
  8. def find(p: (A) => Boolean): (S) => Option[A]

    find the first target matching the predicate

    find the first target matching the predicate

    Definition Classes
    Fold
  9. def fold(s: S)(implicit ev: Monoid[A]): A

    combine all targets using a target's Monoid

    combine all targets using a target's Monoid

    Definition Classes
    Fold
  10. def foldMap[M](f: (A) => M)(s: S)(implicit arg0: Monoid[M]): M

    map each target to a Monoid and combine the results

    map each target to a Monoid and combine the results

    Definition Classes
    PTraversalFold
  11. def getAll(s: S): List[A]

    get all the targets of a Fold

    get all the targets of a Fold

    Definition Classes
    Fold
  12. def headOption(s: S): Option[A]

    get the first target

    get the first target

    Definition Classes
    Fold
  13. def index[I, A1](i: I)(implicit evIndex: Index[A, I, A1], evMonoS: =:=[S, T], evMonoA: =:=[A, B]): Traversal[S, A1]
    Definition Classes
    PTraversalPSetter
  14. def index[I, A1](i: I)(implicit evIndex: Index[A, I, A1]): Fold[S, A1]
    Definition Classes
    Fold
  15. def isEmpty(s: S): Boolean

    check if there is no target

    check if there is no target

    Definition Classes
    Fold
  16. def lastOption(s: S): Option[A]

    get the last target

    get the last target

    Definition Classes
    Fold
  17. def length(s: S): Int

    calculate the number of targets

    calculate the number of targets

    Definition Classes
    Fold
  18. def modify(f: (A) => B): (S) => T

    modify polymorphically the target of a PTraversal with a function

    modify polymorphically the target of a PTraversal with a function

    Definition Classes
    PTraversalPSetter
  19. def nonEmpty(s: S): Boolean

    check if there is at least one target

    check if there is at least one target

    Definition Classes
    Fold
  20. def parModifyF[F[_]](f: (A) => F[B])(s: S)(implicit F: Parallel[F]): F[T]

    PTraversal.modifyA for a Parallel applicative functor.

  21. def replace(b: B): (S) => T

    replace polymorphically the target of a PTraversal with a value

    replace polymorphically the target of a PTraversal with a value

    Definition Classes
    PTraversalPSetter
  22. def some[A1, B1](implicit ev1: =:=[A, Option[A1]], ev2: =:=[B, Option[B1]]): PTraversal[S, T, A1, B1]
    Definition Classes
    PTraversalPSetter
  23. def some[A1](implicit ev1: =:=[A, Option[A1]]): Fold[S, A1]
    Definition Classes
    Fold
  24. def to[C](f: (A) => C): Fold[S, C]

    Compose with a function lifted into a Getter

    Compose with a function lifted into a Getter

    Definition Classes
    Fold

Deprecated Value Members

  1. def left[C]: Fold[Either[S, C], Either[A, C]]
    Definition Classes
    Fold
    Annotations
    @deprecated
    Deprecated

    (Since version 3.0.0-M4) no replacement

  2. def right[C]: Fold[Either[C, S], Either[C, A]]
    Definition Classes
    Fold
    Annotations
    @deprecated
    Deprecated

    (Since version 3.0.0-M4) no replacement

  3. def set(b: B): (S) => T

    alias to replace

    alias to replace

    Definition Classes
    PSetter
    Annotations
    @deprecated
    Deprecated

    (Since version 3.0.0-M1) use replace instead