monocle
Members list
Type members
Classlikes
Attributes
- Source:
- Focus.scala
- Graph
- Supertypes
- Self type
- Focus.type
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 Serializableclass Objecttrait Matchableclass Any
- Known subtypes
- Self type
Attributes
- Companion:
- trait
- Source:
- Fold.scala
- Graph
- Supertypes
- Self type
- Fold.type
Attributes
- Source:
- Fold.scala
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Known subtypes
- object Fold.type
Extension methods for Fold
Attributes
- Companion:
- trait
- Source:
- Getter.scala
- Graph
- Supertypes
- Self type
- Getter.type
Attributes
- Source:
- Getter.scala
- Graph
- Supertypes
- Known subtypes
- object Getter.type
Attributes
- Source:
- Getter.scala
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Known subtypes
- class GetterInstancesobject Getter.type
Extension methods for Fold
Attributes
- Source:
- Lens.scala
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- Lens.type
Attributes
- Source:
- Lens.scala
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Known subtypes
- object PLens.type
Extension methods for monomorphic Lens
Attributes
- Source:
- Monocle.scala
- Graph
- Supertypes
- trait StdInstancestrait ValidatedOpticstrait NonEmptyVectorOpticstrait NonEmptyListOpticstrait NonEmptyChainOpticstrait TheseOpticstrait ChainOpticstrait TryOpticstrait Tuple1Opticstrait StringOpticstrait OptionOpticstrait MapOpticstrait LongOpticstrait ListOpticstrait IntOpticstrait FunctionOpticstrait EitherOpticstrait DoubleOpticstrait CharOpticstrait ByteOpticstrait BigIntOpticstrait BigDecimalOpticstrait GenericOpticstrait Snoc1Functionstrait SnocFunctionstrait ReverseFunctionstrait PossibleFunctionstrait PlatedFunctionstrait CommonPlatedFunctionstrait IndexFunctionstrait FilterIndexFunctionstrait Field6Functionstrait Field5Functionstrait Field4Functionstrait Field3Functionstrait Field2Functionstrait Field1Functionstrait EmptyFunctionstrait EachFunctionstrait CurryFunctionstrait Cons1Functionstrait ConsFunctionstrait AtFunctionstrait Syntaxestrait FieldsSyntaxtrait MacroSyntaxtrait ComposedFocusSyntaxtrait AppliedFocusSyntaxtrait AppliedSyntaxclass Objecttrait Matchableclass Any
- Self type
- Monocle.type
Attributes
- Source:
- Optional.scala
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- Optional.type
Attributes
- Source:
- Optional.scala
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Known subtypes
- object POptional.type
Extension methods for monomorphic Optional
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
Attributes
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 anS
, we can extract anA
set: (B, S) => T
i.e. if we replace anA
by aB
in anS
, we obtain aT
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
Attributes
- Companion:
- trait
- Source:
- Lens.scala
- Graph
- Supertypes
- Self type
- PLens.type
Attributes
- Source:
- Lens.scala
- Graph
- Supertypes
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
Attributes
- Companion:
- trait
- Source:
- Optional.scala
- Graph
- Supertypes
- Self type
- POptional.type
Attributes
- Source:
- Optional.scala
- Graph
- Supertypes
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
Attributes
- Companion:
- trait
- Source:
- Prism.scala
- Graph
- Supertypes
- Self type
- PPrism.type
Attributes
- Source:
- Prism.scala
- Graph
- Supertypes
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
Attributes
- Companion:
- trait
- Source:
- Setter.scala
- Graph
- Supertypes
- Self type
- PSetter.type
Attributes
- Source:
- Setter.scala
- Graph
- Supertypes
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
- Known subtypes
- Self type
Attributes
- Companion:
- trait
- Source:
- Traversal.scala
- Graph
- Supertypes
- Self type
- PTraversal.type
Attributes
- Source:
- Traversal.scala
- Graph
- Supertypes
Attributes
- Source:
- Prism.scala
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- Prism.type
Attributes
- Source:
- Prism.scala
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Known subtypes
- object PPrism.type
Attributes
- Source:
- Prism.scala
- Graph
- Supertypes
Attributes
- Source:
- Setter.scala
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- Setter.type
Attributes
- Source:
- Setter.scala
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Known subtypes
- object PSetter.type
Extension methods for monomorphic Setter
Attributes
- Source:
- Traversal.scala
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Self type
- Traversal.type
Attributes
- Source:
- Traversal.scala
- Graph
- Supertypes
- class Objecttrait Matchableclass Any
- Known subtypes
- object PTraversal.type
Extension methods for monomorphic Traversal
Types
Attributes
- Source:
- package.scala
Attributes
- Source:
- package.scala
Attributes
- Source:
- package.scala
Attributes
- Source:
- package.scala
Attributes
- Source:
- package.scala
Attributes
- Source:
- package.scala
Attributes
- Source:
- package.scala
Attributes
- Source:
- package.scala
Attributes
- Source:
- package.scala
Attributes
- Source:
- package.scala
Attributes
- Source:
- package.scala
Attributes
- Source:
- package.scala
Attributes
- Source:
- package.scala
Attributes
- Source:
- package.scala