Class/Object

monocle

PPrism

Related Docs: object PPrism | package monocle

Permalink

abstract class PPrism[S, T, A, B] extends Serializable

A PPrism can be seen as a pair of functions:

A PPrism could also be defined as a weaker PIso where get can fail.

Typically a PPrism or Prism encodes the relation between a Sum or CoProduct type (e.g. sealed trait) and one of it is element.

PPrism stands for Polymorphic Prism as it set and modify methods change a type A to B and S to T. Prism is a type alias for PPrism where the type of target cannot be modified:

type Prism[S, A] = PPrism[S, S, A, A]

A PPrism is also a valid Fold, POptional, PTraversal and PSetter

S

the source of a PPrism

T

the modified source of a PPrism

A

the target of a PPrism

B

the modified target of a PPrism

Self Type
PPrism[S, T, A, B]
See also

monocle.law.PrismLaws

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

Instance Constructors

  1. new PPrism()

    Permalink

Abstract Value Members

  1. abstract def getOption(s: S): Option[A]

    Permalink

    get the target of a PPrism or nothing if there is no target

  2. abstract def getOrModify(s: S): \/[T, A]

    Permalink

    get the target of a PPrism or return the original value while allowing the type to change if it does not match

  3. abstract def reverseGet(b: B): T

    Permalink

    get the modified source of a PPrism

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def ^<->[C, D](other: PIso[A, B, C, D]): PPrism[S, T, C, D]

    Permalink

    alias to composeIso

    alias to composeIso

    Annotations
    @inline()
  5. final def ^<-?[C, D](other: PPrism[A, B, C, D]): PPrism[S, T, C, D]

    Permalink

    alias to composePrism

    alias to composePrism

    Annotations
    @inline()
  6. final def ^|->[C, D](other: PLens[A, B, C, D]): POptional[S, T, C, D]

    Permalink

    alias to composeLens

    alias to composeLens

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

    Permalink

    alias to composeTraversal

    alias to composeTraversal

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

    Permalink

    alias to composeOptional

    alias to composeOptional

    Annotations
    @inline()
  9. final def asFold: Fold[S, A]

    Permalink

    view a PPrism as a Fold

    view a PPrism as a Fold

    Annotations
    @inline()
  10. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  11. final def asOptional: POptional[S, T, A, B]

    Permalink

    view a PPrism as a POptional

    view a PPrism as a POptional

    Annotations
    @inline()
  12. final def asSetter: PSetter[S, T, A, B]

    Permalink

    view a PPrism as a Setter

    view a PPrism as a Setter

    Annotations
    @inline()
  13. final def asTraversal: PTraversal[S, T, A, B]

    Permalink

    view a PPrism as a PTraversal

    view a PPrism as a PTraversal

    Annotations
    @inline()
  14. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  15. final def composeFold[C](other: Fold[A, C]): Fold[S, C]

    Permalink

    compose a PPrism with a Fold

    compose a PPrism with a Fold

    Annotations
    @inline()
  16. final def composeGetter[C](other: Getter[A, C]): Fold[S, C]

    Permalink

    compose a PPrism with a Getter

    compose a PPrism with a Getter

    Annotations
    @inline()
  17. final def composeIso[C, D](other: PIso[A, B, C, D]): PPrism[S, T, C, D]

    Permalink

    compose a PPrism with a PIso

    compose a PPrism with a PIso

    Annotations
    @inline()
  18. final def composeLens[C, D](other: PLens[A, B, C, D]): POptional[S, T, C, D]

    Permalink

    compose a PPrism with a PLens

    compose a PPrism with a PLens

    Annotations
    @inline()
  19. final def composeOptional[C, D](other: POptional[A, B, C, D]): POptional[S, T, C, D]

    Permalink

    compose a PPrism with a POptional

    compose a PPrism with a POptional

    Annotations
    @inline()
  20. final def composePrism[C, D](other: PPrism[A, B, C, D]): PPrism[S, T, C, D]

    Permalink

    compose a PPrism with a PPrism

    compose a PPrism with a PPrism

    Annotations
    @inline()
  21. final def composeSetter[C, D](other: PSetter[A, B, C, D]): PSetter[S, T, C, D]

    Permalink

    compose a PPrism with a PSetter

    compose a PPrism with a PSetter

    Annotations
    @inline()
  22. final def composeTraversal[C, D](other: PTraversal[A, B, C, D]): PTraversal[S, T, C, D]

    Permalink

    compose a PPrism with a PTraversal

    compose a PPrism with a PTraversal

    Annotations
    @inline()
  23. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  24. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  25. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  26. final def first[C]: PPrism[(S, C), (T, C), (A, C), (B, C)]

    Permalink
    Annotations
    @inline()
  27. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  28. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  29. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  30. final def isMatching(s: S): Boolean

    Permalink

    check if a PPrism has a target

    check if a PPrism has a target

    Annotations
    @inline()
  31. final def left[C]: PPrism[\/[S, C], \/[T, C], \/[A, C], \/[B, C]]

    Permalink
    Annotations
    @inline()
  32. final def modify(f: (A) ⇒ B): (S) ⇒ T

    Permalink

    modify polymorphically the target of a PPrism with a function

    modify polymorphically the target of a PPrism with a function

    Annotations
    @inline()
  33. final def modifyF[F[_]](f: (A) ⇒ F[B])(s: S)(implicit arg0: Applicative[F]): F[T]

    Permalink

    modify polymorphically the target of a PPrism with an Applicative function

    modify polymorphically the target of a PPrism with an Applicative function

    Annotations
    @inline()
  34. final def modifyOption(f: (A) ⇒ B): (S) ⇒ Option[T]

    Permalink

    modify polymorphically the target of a PPrism with a function.

    modify polymorphically the target of a PPrism with a function. return empty if the PPrism is not matching

    Annotations
    @inline()
  35. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  36. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  37. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  38. final def re: Getter[B, T]

    Permalink

    create a Getter from the modified target to the modified source of a PPrism

    create a Getter from the modified target to the modified source of a PPrism

    Annotations
    @inline()
  39. final def right[C]: PPrism[\/[C, S], \/[C, T], \/[C, A], \/[C, B]]

    Permalink
    Annotations
    @inline()
  40. final def second[C]: PPrism[(C, S), (C, T), (C, A), (C, B)]

    Permalink
    Annotations
    @inline()
  41. final def set(b: B): (S) ⇒ T

    Permalink

    set polymorphically the target of a PPrism with a value

    set polymorphically the target of a PPrism with a value

    Annotations
    @inline()
  42. final def setOption(b: B): (S) ⇒ Option[T]

    Permalink

    set polymorphically the target of a PPrism with a value.

    set polymorphically the target of a PPrism with a value. return empty if the PPrism is not matching

    Annotations
    @inline()
  43. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  44. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  45. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  46. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  47. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. final def getMaybe(s: S): Maybe[A]

    Permalink
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 1.1.0) use getOption

  2. final def modifyMaybe(f: (A) ⇒ B): (S) ⇒ Maybe[T]

    Permalink
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 1.1.0) use modifyOption

  3. final def setMaybe(b: B): (S) ⇒ Maybe[T]

    Permalink
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 1.1.0) use setOption

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped