Packages

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

A POptional can be seen as a pair of functions:

  • getOrModify: S => Either[T, A]
  • set : (B, S) => T

A POptional could also be defined as a weaker PLens and weaker PPrism

POptional stands for Polymorphic Optional as it set and modify methods change a type A to B and S to T. Optional is a type alias for POptional restricted to monomorphic updates:

type Optional[S, A] = POptional[S, S, A, A]
S

the source of a POptional

T

the modified source of a POptional

A

the target of a POptional

B

the modified target of a POptional

Self Type
POptional[S, T, A, B]
Source
Optional.scala
See also

monocle.law.OptionalLaws

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

Instance Constructors

  1. new POptional()

Abstract Value Members

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

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

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

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

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

    modify polymorphically the target of a POptional with a function

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

    modify polymorphically the target of a POptional with an Applicative function

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

    get the modified source of a POptional

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 ^<->[C, D](other: PIso[A, B, C, D]): POptional[S, T, C, D]

    alias to composeIso

    alias to composeIso

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

    alias to composePrism

    alias to composePrism

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

    alias to composeLens

    alias to composeLens

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

    alias to composeTraversal

    alias to composeTraversal

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

    alias to composeOptional

    alias to composeOptional

    Annotations
    @inline()
  9. final def all(p: (A) => Boolean): (S) => Boolean

    check if there is no target or the target satisfies the predicate

    check if there is no target or the target satisfies the predicate

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

    view a POptional as a Fold

    view a POptional as a Fold

    Annotations
    @inline()
  11. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  12. final def asSetter: PSetter[S, T, A, B]

    view a POptional as a PSetter

    view a POptional as a PSetter

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

    view a POptional as a PTraversal

    view a POptional as a PTraversal

    Annotations
    @inline()
  14. final def choice[S1, T1](other: POptional[S1, T1, A, B]): POptional[Either[S, S1], Either[T, T1], A, B]

    join two POptional with the same target

    join two POptional with the same target

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

    compose a POptional with a Fold

    compose a POptional with a Fold

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

    compose a POptional with a Getter

    compose a POptional with a Getter

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

    compose a POptional with a PIso

    compose a POptional with a PIso

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

    compose a POptional with a PLens

    compose a POptional with a PLens

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

    compose a POptional with a POptional

    compose a POptional with a POptional

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

    compose a POptional with a PPrism

    compose a POptional with a PPrism

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

    compose a POptional with a PSetter

    compose a POptional with a PSetter

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

    compose a POptional with a PTraversal

    compose a POptional with a PTraversal

    Annotations
    @inline()
  24. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  25. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  26. final def exist(p: (A) => Boolean): (S) => Boolean

    check if there is a target and it satisfies the predicate

    check if there is a target and it satisfies the predicate

    Annotations
    @inline()
  27. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  28. 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()
  29. final def first[C]: POptional[(S, C), (T, C), (A, C), (B, C)]
    Annotations
    @inline()
  30. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  31. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  32. final def isEmpty(s: S): Boolean

    check if there is no target

    check if there is no target

    Annotations
    @inline()
  33. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  34. final def modifyOption(f: (A) => B): (S) => Option[T]

    modify polymorphically the target of a POptional with a function.

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

    Annotations
    @inline()
  35. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  36. final def nonEmpty(s: S): Boolean

    check if there is a target

    check if there is a target

    Annotations
    @inline()
  37. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  38. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  39. final def second[C]: POptional[(C, S), (C, T), (C, A), (C, B)]
    Annotations
    @inline()
  40. final def setOption(b: B): (S) => Option[T]

    set polymorphically the target of a POptional with a value.

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

    Annotations
    @inline()
  41. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  42. def toString(): String
    Definition Classes
    AnyRef → Any
  43. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  44. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  45. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped