PTraversal

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.

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]
Type Params
A

the target of a PTraversal

B

the modified target of a PTraversal

S

the source of a PTraversal

T

the modified source of a PTraversal

See also
Companion
object
Source
Traversal.scala
trait Fold[S, A]
trait PSetter[S, T, A, B]
trait Serializable
class Object
trait Matchable
class Any
trait POptional[S, T, A, B]
trait PLens[S, T, A, B]
trait PIso[S, T, A, B]
trait PPrism[S, T, A, B]

Value members

Abstract methods

def modifyA[F[_]](f: A => F[B])(s: S)(`evidence$1`: Applicative[F]): F[T]

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

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

Source
Traversal.scala

Concrete methods

def andThen[C, D](other: PTraversal[A, B, C, D]): PTraversal[S, T, C, D]

compose a PTraversal with another PTraversal

compose a PTraversal with another PTraversal

Source
Traversal.scala
def asFold: Fold[S, A]

view a PTraversal as a Fold

view a PTraversal as a Fold

Source
Traversal.scala
def asSetter: PSetter[S, T, A, B]

view a PTraversal as a PSetter

def foldMap[M](f: A => M)(s: S)(`evidence$2`: Monoid[M]): M

map each target to a Monoid and combine the results

map each target to a Monoid and combine the results

Source
Traversal.scala
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

Source
Traversal.scala
def parModifyF[F[_]](f: A => F[B])(s: S)(F: Parallel[F]): F[T]

PTraversal.modifyA for a Parallel applicative functor.

PTraversal.modifyA for a Parallel applicative functor.

Source
Traversal.scala
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

Source
Traversal.scala
override def some[A1, B1](ev1: A =:= Option[A1], ev2: B =:= Option[B1]): PTraversal[S, T, A1, B1]
Definition Classes
Source
Traversal.scala

Deprecated methods

@deprecated("use andThen", since = "3.0.0-M1")
def ^<->[C, D](other: PIso[A, B, C, D]): PTraversal[S, T, C, D]
Implicitly added by pTraversalSyntax

alias to composeIso

alias to composeIso

Deprecated
[Since version 3.0.0-M1]
Source
Traversal.scala
@deprecated("use andThen", since = "3.0.0-M1")
def ^<-?[C, D](other: PPrism[A, B, C, D]): PTraversal[S, T, C, D]
Implicitly added by pTraversalSyntax

alias to composePrism

alias to composePrism

Deprecated
[Since version 3.0.0-M1]
Source
Traversal.scala
@deprecated("use andThen", since = "3.0.0-M1")
def ^|->[C, D](other: PLens[A, B, C, D]): PTraversal[S, T, C, D]
Implicitly added by pTraversalSyntax

alias to composeLens

alias to composeLens

Deprecated
[Since version 3.0.0-M1]
Source
Traversal.scala
@deprecated("use andThen", since = "3.0.0-M1")
def ^|->>[C, D](other: PTraversal[A, B, C, D]): PTraversal[S, T, C, D]
Implicitly added by pTraversalSyntax

alias to composeTraversal

alias to composeTraversal

Deprecated
[Since version 3.0.0-M1]
Source
Traversal.scala
@deprecated("use andThen", since = "3.0.0-M1")
def ^|-?[C, D](other: POptional[A, B, C, D]): PTraversal[S, T, C, D]
Implicitly added by pTraversalSyntax

alias to composeOptional

alias to composeOptional

Deprecated
[Since version 3.0.0-M1]
Source
Traversal.scala
@deprecated("use andThen", since = "3.0.0-M1")
def composeFold[C](other: Fold[A, C]): Fold[S, C]
Implicitly added by pTraversalSyntax

compose a PTraversal with a Fold

compose a PTraversal with a Fold

Deprecated
[Since version 3.0.0-M1]
Source
Traversal.scala
@deprecated("use andThen", since = "3.0.0-M1")
def composeGetter[C](other: Getter[A, C]): Fold[S, C]
Implicitly added by pTraversalSyntax

compose a PTraversal with a Getter

compose a PTraversal with a Getter

Deprecated
[Since version 3.0.0-M1]
Source
Traversal.scala
@deprecated("use andThen", since = "3.0.0-M1")
def composeIso[C, D](other: PIso[A, B, C, D]): PTraversal[S, T, C, D]
Implicitly added by pTraversalSyntax

compose a PTraversal with a PIso

compose a PTraversal with a PIso

Deprecated
[Since version 3.0.0-M1]
Source
Traversal.scala
@deprecated("use andThen", since = "3.0.0-M1")
def composeLens[C, D](other: PLens[A, B, C, D]): PTraversal[S, T, C, D]
Implicitly added by pTraversalSyntax

compose a PTraversal with a PLens

compose a PTraversal with a PLens

Deprecated
[Since version 3.0.0-M1]
Source
Traversal.scala
@deprecated("use andThen", since = "3.0.0-M1")
def composeOptional[C, D](other: POptional[A, B, C, D]): PTraversal[S, T, C, D]
Implicitly added by pTraversalSyntax

compose a PTraversal with a POptional

compose a PTraversal with a POptional

Deprecated
[Since version 3.0.0-M1]
Source
Traversal.scala
@deprecated("use andThen", since = "3.0.0-M1")
def composePrism[C, D](other: PPrism[A, B, C, D]): PTraversal[S, T, C, D]
Implicitly added by pTraversalSyntax

compose a PTraversal with a PPrism

compose a PTraversal with a PPrism

Deprecated
[Since version 3.0.0-M1]
Source
Traversal.scala
@deprecated("use andThen", since = "3.0.0-M1")
def composeSetter[C, D](other: PSetter[A, B, C, D]): PSetter[S, T, C, D]
Implicitly added by pTraversalSyntax

compose a PTraversal with a PSetter

compose a PTraversal with a PSetter

Deprecated
[Since version 3.0.0-M1]
Source
Traversal.scala
@deprecated("use andThen", since = "3.0.0-M1")
def composeTraversal[C, D](other: PTraversal[A, B, C, D]): PTraversal[S, T, C, D]
Implicitly added by pTraversalSyntax

compose a PTraversal with a PTraversal

compose a PTraversal with a PTraversal

Deprecated
[Since version 3.0.0-M1]
Source
Traversal.scala

Inherited methods

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

check if all targets satisfy the predicate

check if all targets satisfy the predicate

Inherited from
Fold
Source
Fold.scala
def andThen[B](other: Fold[A, B]): Fold[S, B]

compose a Fold with another Fold

compose a Fold with another Fold

Inherited from
Fold
Source
Fold.scala
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

Inherited from
PSetter
Source
Setter.scala
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

Inherited from
Fold
Source
Fold.scala
def find(p: A => Boolean): S => Option[A]

find the first target matching the predicate

find the first target matching the predicate

Inherited from
Fold
Source
Fold.scala
def fold(s: S)(ev: Monoid[A]): A

combine all targets using a target's Monoid

combine all targets using a target's Monoid

Inherited from
Fold
Source
Fold.scala
def getAll(s: S): List[A]

get all the targets of a Fold

get all the targets of a Fold

Inherited from
Fold
Source
Fold.scala
def headOption(s: S): Option[A]

get the first target

get the first target

Inherited from
Fold
Source
Fold.scala
def isEmpty(s: S): Boolean

check if there is no target

check if there is no target

Inherited from
Fold
Source
Fold.scala
def lastOption(s: S): Option[A]

get the last target

get the last target

Inherited from
Fold
Source
Fold.scala
def length(s: S): Int

calculate the number of targets

calculate the number of targets

Inherited from
Fold
Source
Fold.scala
def nonEmpty(s: S): Boolean

check if there is at least one target

check if there is at least one target

Inherited from
Fold
Source
Fold.scala
def productElementNames: Iterator[String]
Implicitly added by pTraversalSyntax
Inherited from
Product
def productIterator: Iterator[Any]
Implicitly added by pTraversalSyntax
Inherited from
Product
def some[A1](ev1: A =:= Option[A1]): Fold[S, A1]
Inherited from
Fold
Source
Fold.scala
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

Inherited from
Fold
Source
Fold.scala

Deprecated and Inherited methods

@deprecated("no replacement", since = "3.0.0-M4")
def left[C]: Fold[Either[S, C], Either[A, C]]
Deprecated
[Since version 3.0.0-M4]
Inherited from
Fold
Source
Fold.scala
@deprecated("no replacement", since = "3.0.0-M4")
def right[C]: Fold[Either[C, S], Either[C, A]]
Deprecated
[Since version 3.0.0-M4]
Inherited from
Fold
Source
Fold.scala
@deprecated("use replace instead", since = "3.0.0-M1")
def set(b: B): S => T

alias to replace

alias to replace

Deprecated
[Since version 3.0.0-M1]
Inherited from
PSetter
Source
Setter.scala