monocle

package monocle

Members list

Concise view

Type members

Classlikes

Attributes

Source:
Focus.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Focus.type
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

Attributes

A

the target of a Fold

S

the source of a Fold

Companion:
object
Source:
Fold.scala
Graph
Supertypes
trait Serializable
class Object
trait Matchable
class Any
Known subtypes
trait Getter[S, A]
trait PLens[S, T, A, B]
trait PIso[S, T, A, B]
trait PTraversal[S, T, A, B]
trait POptional[S, T, A, B]
trait PPrism[S, T, A, B]
Self type
Fold[S, A]
object Fold extends FoldInstances

Attributes

Companion:
trait
Source:
Fold.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Fold.type
sealed abstract class FoldInstances

Attributes

Source:
Fold.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Fold.type
final case class FoldSyntax[S, A](self: Fold[S, A]) extends AnyVal

Extension methods for Fold

Extension methods for Fold

Attributes

Source:
Fold.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class AnyVal
trait Matchable
class Any
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

Attributes

A

the target of a Getter

S

the source of a Getter

Companion:
object
Source:
Getter.scala
Graph
Supertypes
trait Fold[S, A]
trait Serializable
class Object
trait Matchable
class Any
Known subtypes
trait PLens[S, T, A, B]
trait PIso[S, T, A, B]
Self type
Getter[S, A]
object Getter extends GetterInstances

Attributes

Companion:
trait
Source:
Getter.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Getter.type
sealed abstract class GetterInstances extends GetterInstances0

Attributes

Source:
Getter.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Getter.type
sealed abstract class GetterInstances0

Attributes

Source:
Getter.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Getter.type
final case class GetterSyntax[S, A](self: Getter[S, A]) extends AnyVal

Extension methods for Fold

Extension methods for Fold

Attributes

Source:
Getter.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class AnyVal
trait Matchable
class Any
object Iso

Attributes

Source:
Iso.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Iso.type
sealed abstract class IsoInstances

Attributes

Source:
Iso.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object PIso.type
final case class IsoSyntax[S, A](self: Iso[S, A]) extends AnyVal

Extension methods for monomorphic Iso

Extension methods for monomorphic Iso

Attributes

Source:
Iso.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class AnyVal
trait Matchable
class Any
object Lens

Attributes

Source:
Lens.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Lens.type
sealed abstract class LensInstances

Attributes

Source:
Lens.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object PLens.type
final case class LensSyntax[S, A](self: Lens[S, A]) extends AnyVal

Extension methods for monomorphic Lens

Extension methods for monomorphic Lens

Attributes

Source:
Lens.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class AnyVal
trait Matchable
class Any
object Monocle extends Syntaxes with GenericOptics with StdInstances

Attributes

Source:
Monocle.scala
Graph
Supertypes
Self type
Monocle.type
object Optional

Attributes

Source:
Optional.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
sealed abstract class OptionalInstances

Attributes

Source:
Optional.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object POptional.type
final case class OptionalSyntax[S, A](self: Optional[S, A]) extends AnyVal

Extension methods for monomorphic Optional

Extension methods for monomorphic Optional

Attributes

Source:
Optional.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class AnyVal
trait Matchable
class Any
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

Attributes

A

the target of a PIso

B

the modified target of a PIso

S

the source of a PIso

T

the modified source of a PIso

See also:
Companion:
object
Source:
Iso.scala
Graph
Supertypes
trait PPrism[S, T, A, B]
trait PLens[S, T, A, B]
trait Getter[S, A]
trait POptional[S, T, A, B]
trait PTraversal[S, T, A, B]
trait Fold[S, A]
trait PSetter[S, T, A, B]
trait Serializable
class Object
trait Matchable
class Any
Self type
PIso[S, T, A, B]
object PIso extends IsoInstances

Attributes

Companion:
trait
Source:
Iso.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
PIso.type
final case class PIsoSyntax[S, T, A, B](self: PIso[S, T, A, B]) extends AnyVal

Attributes

Source:
Iso.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class AnyVal
trait Matchable
class Any
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.

Attributes

A

the target of a PLens

B

the modified target of a PLens

S

the source of a PLens

T

the modified source of a PLens

See also:
Companion:
object
Source:
Lens.scala
Graph
Supertypes
trait Getter[S, A]
trait POptional[S, T, A, B]
trait PTraversal[S, T, A, B]
trait Fold[S, A]
trait PSetter[S, T, A, B]
trait Serializable
class Object
trait Matchable
class Any
Known subtypes
trait PIso[S, T, A, B]
Self type
PLens[S, T, A, B]
object PLens extends LensInstances

Attributes

Companion:
trait
Source:
Lens.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
PLens.type
final case class PLensSyntax[S, T, A, B](self: PLens[S, T, A, B]) extends AnyVal

Attributes

Source:
Lens.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class AnyVal
trait Matchable
class Any
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]

Attributes

A

the target of a POptional

B

the modified target of a POptional

S

the source of a POptional

T

the modified source of a POptional

See also:
Companion:
object
Source:
Optional.scala
Graph
Supertypes
trait PTraversal[S, T, A, B]
trait Fold[S, A]
trait PSetter[S, T, A, B]
trait Serializable
class Object
trait Matchable
class Any
Known subtypes
trait PLens[S, T, A, B]
trait PIso[S, T, A, B]
trait PPrism[S, T, A, B]
Self type
POptional[S, T, A, B]

Attributes

Companion:
trait
Source:
Optional.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
final case class POptionalSyntax[S, T, A, B](self: POptional[S, T, A, B]) extends AnyVal

Attributes

Source:
Optional.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class AnyVal
trait Matchable
class Any
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

Attributes

A

the target of a PPrism

B

the modified target of a PPrism

S

the source of a PPrism

T

the modified source of a PPrism

See also:
Companion:
object
Source:
Prism.scala
Graph
Supertypes
trait POptional[S, T, A, B]
trait PTraversal[S, T, A, B]
trait Fold[S, A]
trait PSetter[S, T, A, B]
trait Serializable
class Object
trait Matchable
class Any
Known subtypes
trait PIso[S, T, A, B]
Self type
PPrism[S, T, A, B]
object PPrism extends PrismInstances

Attributes

Companion:
trait
Source:
Prism.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
PPrism.type
final case class PPrismSyntax[S, T, A, B](self: PPrism[S, T, A, B]) extends AnyVal

Attributes

Source:
Prism.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class AnyVal
trait Matchable
class Any
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

Attributes

A

the target of a PSetter

B

the modified target of a PSetter

S

the source of a PSetter

T

the modified source of a PSetter

See also:
Companion:
object
Source:
Setter.scala
Graph
Supertypes
trait Serializable
class Object
trait Matchable
class Any
Known subtypes
trait PTraversal[S, T, A, B]
trait POptional[S, T, A, B]
trait PLens[S, T, A, B]
trait PIso[S, T, A, B]
trait PPrism[S, T, A, B]
Self type
PSetter[S, T, A, B]
object PSetter extends SetterInstances

Attributes

Companion:
trait
Source:
Setter.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
PSetter.type
final case class PSetterSyntax[S, T, A, B](self: PSetter[S, T, A, B]) extends AnyVal

Attributes

Source:
Setter.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class AnyVal
trait Matchable
class Any
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]

Attributes

A

the target of a PTraversal

B

the modified target of a PTraversal

S

the source of a PTraversal

T

the modified source of a PTraversal

See also:
Companion:
object
Source:
Traversal.scala
Graph
Supertypes
trait Fold[S, A]
trait PSetter[S, T, A, B]
trait Serializable
class Object
trait Matchable
class Any
Known subtypes
trait POptional[S, T, A, B]
trait PLens[S, T, A, B]
trait PIso[S, T, A, B]
trait PPrism[S, T, A, B]
Self type
PTraversal[S, T, A, B]

Attributes

Companion:
trait
Source:
Traversal.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
final case class PTraversalSyntax[S, T, A, B](self: PTraversal[S, T, A, B]) extends AnyVal

Attributes

Source:
Traversal.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class AnyVal
trait Matchable
class Any
object Prism

Attributes

Source:
Prism.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Prism.type
sealed abstract class PrismInstances

Attributes

Source:
Prism.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object PPrism.type
final case class PrismSyntax[S, A](self: Prism[S, A]) extends AnyVal

Attributes

Source:
Prism.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class AnyVal
trait Matchable
class Any
object Setter

Attributes

Source:
Setter.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Setter.type
sealed abstract class SetterInstances

Attributes

Source:
Setter.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object PSetter.type
final case class SetterSyntax[S, A](self: Setter[S, A]) extends AnyVal

Extension methods for monomorphic Setter

Extension methods for monomorphic Setter

Attributes

Source:
Setter.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class AnyVal
trait Matchable
class Any
object Traversal

Attributes

Source:
Traversal.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
sealed abstract class TraversalInstances

Attributes

Source:
Traversal.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object PTraversal.type
final case class TraversalSyntax[S, A](self: Traversal[S, A]) extends AnyVal

Extension methods for monomorphic Traversal

Extension methods for monomorphic Traversal

Attributes

Source:
Traversal.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class AnyVal
trait Matchable
class Any

Types

type AppliedFold[S, A] = AppliedFold[S, A]

Attributes

Source:
package.scala
type AppliedGetter[S, A] = AppliedGetter[S, A]

Attributes

Source:
package.scala
type AppliedIso[S, A] = AppliedPIso[S, S, A, A]

Attributes

Source:
package.scala
type AppliedLens[S, A] = AppliedPLens[S, S, A, A]

Attributes

Source:
package.scala
type AppliedOptional[S, A] = AppliedPOptional[S, S, A, A]

Attributes

Source:
package.scala
type AppliedPrism[S, A] = AppliedPPrism[S, S, A, A]

Attributes

Source:
package.scala
type AppliedSetter[S, A] = AppliedPSetter[S, S, A, A]

Attributes

Source:
package.scala
type AppliedTraversal[S, A] = AppliedPTraversal[S, S, A, A]

Attributes

Source:
package.scala
type Iso[S, A] = PIso[S, S, A, A]

Attributes

Source:
package.scala
type Lens[S, A] = PLens[S, S, A, A]

Attributes

Source:
package.scala
type Optional[S, A] = POptional[S, S, A, A]

Attributes

Source:
package.scala
type Prism[S, A] = PPrism[S, S, A, A]

Attributes

Source:
package.scala
type Setter[S, A] = PSetter[S, S, A, A]

Attributes

Source:
package.scala
type Traversal[S, A] = PTraversal[S, S, A, A]

Attributes

Source:
package.scala