p

monocle

package monocle

Source
package.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. monocle
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Package Members

  1. package function
  2. package internal
  3. package law
  4. package std
  5. package syntax

Type Members

  1. type AppliedFold[S, A] = monocle.syntax.AppliedFold[S, A]
  2. type AppliedGetter[S, A] = monocle.syntax.AppliedGetter[S, A]
  3. type AppliedIso[S, A] = AppliedPIso[S, S, A, A]
  4. type AppliedLens[S, A] = AppliedPLens[S, S, A, A]
  5. type AppliedOptional[S, A] = AppliedPOptional[S, S, A, A]
  6. type AppliedPrism[S, A] = AppliedPPrism[S, S, A, A]
  7. type AppliedSetter[S, A] = AppliedPSetter[S, S, A, A]
  8. type AppliedTraversal[S, A] = AppliedPTraversal[S, S, A, A]
  9. trait Fold[S, A] extends Serializable

    A Fold can be seen as a Getter with many targets or a weaker PTraversal which cannot modify its target.

    A Fold can be seen as a Getter with many targets or a weaker PTraversal which cannot modify its target.

    Fold is on the top of the Optic hierarchy which means that Getter, PTraversal, POptional, PLens, PPrism and PIso are valid Fold

    S

    the source of a Fold

    A

    the target of a Fold

  10. sealed abstract class FoldInstances extends AnyRef
  11. final case class FoldSyntax[S, A](self: Fold[S, A]) extends AnyVal with Product with Serializable

    Extension methods for Fold

  12. trait Getter[S, A] extends Fold[S, A]

    A Getter can be seen as a glorified get method between a type S and a type A.

    A Getter can be seen as a glorified get method between a type S and a type A.

    A Getter is also a valid Fold

    S

    the source of a Getter

    A

    the target of a Getter

  13. sealed abstract class GetterInstances extends GetterInstances0
  14. sealed abstract class GetterInstances0 extends AnyRef
  15. final case class GetterSyntax[S, A](self: Getter[S, A]) extends AnyVal with Product with Serializable

    Extension methods for Fold

  16. type Iso[S, A] = PIso[S, S, A, A]
  17. sealed abstract class IsoInstances extends AnyRef
  18. final case class IsoSyntax[S, A](self: Iso[S, A]) extends AnyVal with Product with Serializable

    Extension methods for monomorphic Iso

  19. type Lens[S, A] = PLens[S, S, A, A]
  20. sealed abstract class LensInstances extends AnyRef
  21. final case class LensSyntax[S, A](self: Lens[S, A]) extends AnyVal with Product with Serializable

    Extension methods for monomorphic Lens

  22. type Optional[S, A] = POptional[S, S, A, A]
  23. sealed abstract class OptionalInstances extends AnyRef
  24. final case class OptionalSyntax[S, A](self: Optional[S, A]) extends AnyVal with Product with Serializable

    Extension methods for monomorphic Optional

  25. trait PIso[S, T, A, B] extends PLens[S, T, A, B] with PPrism[S, T, A, B]

    Iso is a type alias for PIso where S = A and T = B:

    Iso is a type alias for PIso where S = A and T = B:

    type Iso[S, A] = PIso[S, S, A, A]

    An Iso defines an isomorphism between a type S and A:

     get
    --------------------> S A <-------------------- reverseGet 
    

    A PIso allows to lift a function f: A => B to S => T and a function g: T => S to B => A

     g S T S
    <-------- T
    | ↑ | ↑
    | | | | get | | reverseGet reverse.reverseGet | | reverse.get
    | | | | ↓ f | ↓ | A --------> B A B 
    

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

    S

    the source of a PIso

    T

    the modified source of a PIso

    A

    the target of a PIso

    B

    the modified target of a PIso

    See also

    monocle.law.IsoLaws

  26. final case class PIsoSyntax[S, T, A, B](self: PIso[S, T, A, B]) extends AnyVal with Product with Serializable
  27. trait PLens[S, T, A, B] extends POptional[S, T, A, B] with Getter[S, A]

    A PLens can be seen as a pair of functions:

    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

    See also

    monocle.law.LensLaws

  28. final case class PLensSyntax[S, T, A, B](self: PLens[S, T, A, B]) extends AnyVal with Product with Serializable
  29. trait POptional[S, T, A, B] extends PTraversal[S, T, A, B]

    A POptional can be seen as a pair of functions:

    A POptional can be seen as a pair of functions:

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

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

    POptional stands for Polymorphic Optional as it replace 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

    See also

    monocle.law.OptionalLaws

  30. final case class POptionalSyntax[S, T, A, B](self: POptional[S, T, A, B]) extends AnyVal with Product with Serializable
  31. trait PPrism[S, T, A, B] extends POptional[S, T, A, B]

    A PPrism can be seen as a pair of functions:

    A PPrism can be seen as a pair of functions:

    • getOrModify: S => Either[T, A]
    • reverseGet : B => T

    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 its element.

    PPrism stands for Polymorphic Prism as it replace 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

    See also

    monocle.law.PrismLaws

  32. final case class PPrismSyntax[S, T, A, B](self: PPrism[S, T, A, B]) extends AnyVal with Product with Serializable
  33. trait PSetter[S, T, A, B] extends Serializable

    A PSetter is a generalisation of Functor map:

    A PSetter is a generalisation of Functor map:

    • map: (A => B) => F[A] => F[B]
    • modify: (A => B) => S => T

    PSetter stands for Polymorphic Setter as it replace and modify methods change a type A to B and S to T. Setter is a type alias for PSetter restricted to monomorphic updates:

    type Setter[S, A] = PSetter[S, S, A, A]

    PTraversal, POptional, PPrism, PLens and PIso are valid PSetter

    S

    the source of a PSetter

    T

    the modified source of a PSetter

    A

    the target of a PSetter

    B

    the modified target of a PSetter

    See also

    monocle.law.SetterLaws

  34. final case class PSetterSyntax[S, T, A, B](self: PSetter[S, T, A, B]) extends AnyVal with Product with Serializable
  35. 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]
    S

    the source of a PTraversal

    T

    the modified source of a PTraversal

    A

    the target of a PTraversal

    B

    the modified target of a PTraversal

    See also

    monocle.law.TraversalLaws

  36. final case class PTraversalSyntax[S, T, A, B](self: PTraversal[S, T, A, B]) extends AnyVal with Product with Serializable
  37. type Prism[S, A] = PPrism[S, S, A, A]
  38. sealed abstract class PrismInstances extends AnyRef
  39. final case class PrismSyntax[S, A](self: Prism[S, A]) extends AnyVal with Product with Serializable
  40. type Setter[S, A] = PSetter[S, S, A, A]
  41. sealed abstract class SetterInstances extends AnyRef
  42. final case class SetterSyntax[S, A](self: Setter[S, A]) extends AnyVal with Product with Serializable

    Extension methods for monomorphic Setter

  43. type Traversal[S, A] = PTraversal[S, S, A, A]
  44. sealed abstract class TraversalInstances extends AnyRef
  45. final case class TraversalSyntax[S, A](self: Traversal[S, A]) extends AnyVal with Product with Serializable

    Extension methods for monomorphic Traversal

Value Members

  1. object Fold extends FoldInstances with Serializable
  2. object Getter extends GetterInstances with Serializable
  3. object Iso
  4. object Lens
  5. object Optional
  6. object PIso extends IsoInstances with Serializable
  7. object PLens extends LensInstances with Serializable
  8. object POptional extends OptionalInstances with Serializable
  9. object PPrism extends PrismInstances with Serializable
  10. object PSetter extends SetterInstances with Serializable
  11. object PTraversal extends TraversalInstances with Serializable
  12. object Prism
  13. object Setter
  14. object Traversal

Inherited from AnyRef

Inherited from Any

Ungrouped