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 an S, we can extract an A
  • set: (B, S) => T i.e. if we replace an A by a B in an S, we obtain a T

A PLens could also be defined as a weaker PIso where replace requires an additional parameter than reverseGet.

PLens stands for Polymorphic Lens as it replace 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]
See also

monocle.law.LensLaws

Linear Supertypes
Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. PLens
  2. Serializable
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new PLens()

Abstract Value Members

  1. abstract def get(s: S): A

    get the target of a PLens

  2. abstract def modify(f: (A) => B): (S) => T

    modify polymorphically the target of a PLens using a function

  3. 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

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

    replace polymorphically the target of a PLens using a function

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def andThen[C, D](other: PIso[A, B, C, D]): PLens[S, T, C, D]

    compose a PLens with an PIso

  5. final def andThen[C, D](other: PLens[A, B, C, D]): PLens[S, T, C, D]

    compose a PLens with a PLens

  6. final def andThen[C, D](other: PPrism[A, B, C, D]): POptional[S, T, C, D]

    compose a PLens with a PPrism

  7. final def andThen[C, D](other: POptional[A, B, C, D]): POptional[S, T, C, D]

    compose a PLens with an POptional

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

    compose a PLens with a PTraversal

  9. final def andThen[C, D](other: PSetter[A, B, C, D]): PSetter[S, T, C, D]

    compose a PLens with a PSetter

  10. final def andThen[C](other: Getter[A, C]): Getter[S, C]

    compose a PLens with a Getter

  11. final def andThen[C](other: Fold[A, C]): Fold[S, C]

    compose a PLens with a Fold

  12. final def asFold: Fold[S, A]

    view a PLens as a Fold

  13. final def asGetter: Getter[S, A]

    view a PLens as a Getter

  14. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  15. final def asOptional: POptional[S, T, A, B]

    view a PLens as an POptional

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

    view a PLens as a PSetter

  17. final def asTraversal: PTraversal[S, T, A, B]

    view a PLens as a PTraversal

  18. 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

  19. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  20. final def composeFold[C](other: Fold[A, C]): Fold[S, C]

    compose a PLens with a Fold

  21. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  22. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  23. final def exist(p: (A) => Boolean): (S) => Boolean

    check if the target satisfies the predicate

  24. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  25. final def find(p: (A) => Boolean): (S) => Option[A]

    find if the target satisfies the predicate

  26. final def first[C]: PLens[(S, C), (T, C), (A, C), (B, C)]
  27. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  28. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  29. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  30. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  31. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  32. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  33. final def second[C]: PLens[(C, S), (C, T), (C, A), (C, B)]
  34. def some[A1, B1](implicit ev1: =:=[A, Option[A1]], ev2: =:=[B, Option[B1]]): POptional[S, T, A1, B1]
  35. 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

  36. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  37. def to[C](f: (A) => C): Getter[S, C]

    Compose with a function lifted into a Getter

  38. def toString(): String
    Definition Classes
    AnyRef → Any
  39. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  40. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  41. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Deprecated Value Members

  1. final def ^<->[C, D](other: PIso[A, B, C, D]): PLens[S, T, C, D]

    alias to composeIso

    alias to composeIso

    Annotations
    @deprecated
    Deprecated

    (Since version 3.0.0-M1) use andThen

  2. final def ^<-?[C, D](other: PPrism[A, B, C, D]): POptional[S, T, C, D]

    alias to composePrism

    alias to composePrism

    Annotations
    @deprecated
    Deprecated

    (Since version 3.0.0-M1) use andThen

  3. final def ^|->[C, D](other: PLens[A, B, C, D]): PLens[S, T, C, D]

    alias to composeLens

    alias to composeLens

    Annotations
    @deprecated
    Deprecated

    (Since version 3.0.0-M1) use andThen

  4. final def ^|->>[C, D](other: PTraversal[A, B, C, D]): PTraversal[S, T, C, D]

    alias to composeTraversal

    alias to composeTraversal

    Annotations
    @deprecated
    Deprecated

    (Since version 3.0.0-M1) use andThen

  5. final def ^|-?[C, D](other: POptional[A, B, C, D]): POptional[S, T, C, D]

    alias to composeOptional

    alias to composeOptional

    Annotations
    @deprecated
    Deprecated

    (Since version 3.0.0-M1) use andThen

  6. final def composeGetter[C](other: Getter[A, C]): Getter[S, C]

    compose a PLens with a Getter

    compose a PLens with a Getter

    Annotations
    @deprecated
    Deprecated

    (Since version 3.0.0-M1) use andThen

  7. final def composeIso[C, D](other: PIso[A, B, C, D]): PLens[S, T, C, D]

    compose a PLens with an PIso

    compose a PLens with an PIso

    Annotations
    @deprecated
    Deprecated

    (Since version 3.0.0-M1) use andThen

  8. final def composeLens[C, D](other: PLens[A, B, C, D]): PLens[S, T, C, D]

    compose a PLens with a PLens

    compose a PLens with a PLens

    Annotations
    @deprecated
    Deprecated

    (Since version 3.0.0-M1) use andThen

  9. final def composeOptional[C, D](other: POptional[A, B, C, D]): POptional[S, T, C, D]

    compose a PLens with an POptional

    compose a PLens with an POptional

    Annotations
    @deprecated
    Deprecated

    (Since version 3.0.0-M1) use andThen

  10. final def composePrism[C, D](other: PPrism[A, B, C, D]): POptional[S, T, C, D]

    compose a PLens with a PPrism

    compose a PLens with a PPrism

    Annotations
    @deprecated
    Deprecated

    (Since version 3.0.0-M1) use andThen

  11. final def composeSetter[C, D](other: PSetter[A, B, C, D]): PSetter[S, T, C, D]

    compose a PLens with a PSetter

    compose a PLens with a PSetter

    Annotations
    @deprecated
    Deprecated

    (Since version 3.0.0-M1) use andThen

  12. 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
    @deprecated
    Deprecated

    (Since version 3.0.0-M1) use andThen

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

    alias to replace

    alias to replace

    Annotations
    @deprecated
    Deprecated

    (Since version 3.0.0-M1) use replace instead

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped