monocle

package monocle

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. monocle
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. abstract class Fold[S, A] extends AnyRef

    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

  2. final class Getter[S, A] extends AnyRef

    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

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

  4. type Lens[S, A] = PLens[S, S, A, A]

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

  6. abstract class PIso[S, T, A, B] extends AnyRef

    A PIso defines an isomorphism between types S, A and B, T:

    A PIso defines an isomorphism between types S, A and B, T:

    get reverse.get --------------------> --------------------> S A T B <-------------------- <-------------------- reverse.reverseGet reverseGet

    In addition, if f and g forms an isomorphism between A and B, i.e. if f . g = id and g . f = id, then a PIso defines an isomorphism between S and T:

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

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

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

    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

    IsoLaws in monocle-law module

  7. abstract class PLens[S, T, A, B] extends AnyRef

    A PLens can be seen as a pair of functions: get: S => A i.e.

    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 a S, we obtain a T

    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 monomoprhic 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 it is 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

    LensLaws in monocle-law module

  8. abstract class POptional[S, T, A, B] extends AnyRef

    A POptional can be seen as a pair of functions: getOrModify: S => T \/ A set : (B, S) => T

    A POptional can be seen as a pair of functions: getOrModify: S => 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 monomoprhic 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

    OptionalLaws in monocle-law module

  9. abstract class PPrism[S, T, A, B] extends AnyRef

    A PPrism can be seen as a pair of functions: getOrModify: S => T \/ A reverseGet : B => T

    A PPrism can be seen as a pair of functions: getOrModify: S => 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 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

    See also

    PrismLaws in monocle-law module

  10. final class PSetter[S, T, A, B] extends AnyRef

    A PSetter is a generalisation of Functor map: map: (A => B) => F[A] => F[B] modify: (A => B) => S => T

    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 set and modify methods change a type A to B and S to T. Setter is a type alias for PSetter restricted to monomoprhic 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

    SetterLaws in monocle-law module

  11. abstract class PTraversal[S, T, A, B] extends AnyRef

    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 set and modify methods change a type A to B and S to T. Traversal is a type alias for PTraversal restricted to monomoprhic 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

    TraversalLaws in monocle-law module

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

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

  14. type Traversal[S, A] = PTraversal[S, S, A, A]

Value Members

  1. object Fold

  2. object Getter

  3. object Iso

  4. object Lens

  5. object Monocle extends Syntaxes with GenericOptics with StdInstances

  6. object Optional

  7. object PIso

  8. object PLens

  9. object POptional

  10. object PPrism

  11. object PSetter

  12. object PTraversal

  13. object Prism

  14. object Setter

  15. object Traversal

  16. package function

  17. package std

  18. package syntax

Inherited from AnyRef

Inherited from Any

Ungrouped