abstract class PLens[S, T, A, B] extends Serializable
A PLens can be seen as a pair of functions:
get: S => A
i.e. from anS
, we can extract anA
set: (B, S) => T
i.e. if we replace anA
by aB
in anS
, we obtain aT
A PLens could also be defined as a weaker PIso where set requires an additional parameter than reverseGet.
PLens stands for Polymorphic Lens as it set and modify methods change
a type A
to B
and S
to T
.
Lens is a type alias for PLens restricted to monomorphic updates:
type Lens[S, A] = PLens[S, S, A, A]
A PLens is also a valid Getter, Fold, POptional, PTraversal and PSetter
Typically a PLens or Lens can be defined between a Product (e.g. case class, tuple, HList) and one of its component.
- S
the source of a PLens
- T
the modified source of a PLens
- A
the target of a PLens
- B
the modified target of a PLens
- Self Type
- PLens[S, T, A, B]
- Source
- Lens.scala
- See also
- Alphabetic
- By Inheritance
- PLens
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new PLens()
Abstract Value Members
- abstract def get(s: S): A
get the target of a PLens
- abstract def modify(f: (A) => B): (S) => T
modify polymorphically the target of a PLens using a function
- abstract def modifyF[F[_]](f: (A) => F[B])(s: S)(implicit arg0: Functor[F]): F[T]
modify polymorphically the target of a PLens using Functor function
- abstract def set(b: B): (S) => T
set polymorphically the target of a PLens using a function
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ^<->[C, D](other: PIso[A, B, C, D]): PLens[S, T, C, D]
alias to composeIso
alias to composeIso
- Annotations
- @inline()
- final def ^<-?[C, D](other: PPrism[A, B, C, D]): POptional[S, T, C, D]
alias to composePrism
alias to composePrism
- Annotations
- @inline()
- final def ^|->[C, D](other: PLens[A, B, C, D]): PLens[S, T, C, D]
alias to composeLens
alias to composeLens
- Annotations
- @inline()
- final def ^|->>[C, D](other: PTraversal[A, B, C, D]): PTraversal[S, T, C, D]
alias to composeTraversal
alias to composeTraversal
- Annotations
- @inline()
- final def ^|-?[C, D](other: POptional[A, B, C, D]): POptional[S, T, C, D]
alias to composeOptional
alias to composeOptional
- Annotations
- @inline()
- final def asFold: Fold[S, A]
- final def asGetter: Getter[S, A]
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- final def asOptional: POptional[S, T, A, B]
- final def asSetter: PSetter[S, T, A, B]
- final def asTraversal: PTraversal[S, T, A, B]
view a PLens as a PTraversal
view a PLens as a PTraversal
- Annotations
- @inline()
- final def choice[S1, T1](other: PLens[S1, T1, A, B]): PLens[Either[S, S1], Either[T, T1], A, B]
join two PLens with the same target
join two PLens with the same target
- Annotations
- @inline()
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def composeFold[C](other: Fold[A, C]): Fold[S, C]
- final def composeGetter[C](other: Getter[A, C]): Getter[S, C]
- final def composeIso[C, D](other: PIso[A, B, C, D]): PLens[S, T, C, D]
- final def composeLens[C, D](other: PLens[A, B, C, D]): PLens[S, T, C, D]
- final def composeOptional[C, D](other: POptional[A, B, C, D]): POptional[S, T, C, D]
- final def composePrism[C, D](other: PPrism[A, B, C, D]): POptional[S, T, C, D]
- final def composeSetter[C, D](other: PSetter[A, B, C, D]): PSetter[S, T, C, D]
- final def composeTraversal[C, D](other: PTraversal[A, B, C, D]): PTraversal[S, T, C, D]
compose a PLens with a PTraversal
compose a PLens with a PTraversal
- Annotations
- @inline()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def exist(p: (A) => Boolean): (S) => Boolean
check if the target satisfies the predicate
check if the target satisfies the predicate
- Annotations
- @inline()
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def find(p: (A) => Boolean): (S) => Option[A]
find if the target satisfies the predicate
find if the target satisfies the predicate
- Annotations
- @inline()
- final def first[C]: PLens[(S, C), (T, C), (A, C), (B, C)]
- Annotations
- @inline()
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def second[C]: PLens[(C, S), (C, T), (C, A), (C, B)]
- Annotations
- @inline()
- final def split[S1, T1, A1, B1](other: PLens[S1, T1, A1, B1]): PLens[(S, S1), (T, T1), (A, A1), (B, B1)]
pair two disjoint PLens
pair two disjoint PLens
- Annotations
- @inline()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()