get the target of a PLens
modify polymorphically the target of a PLens using a function
modify polymorphically the target of a PLens using Functor function
set polymorphically the target of a PLens using a function
alias to composeIso
alias to composeIso
alias to composePrism
alias to composePrism
alias to composeLens
alias to composeLens
alias to composeTraversal
alias to composeTraversal
alias to composeOptional
alias to composeOptional
view a PLens as a PTraversal
view a PLens as a PTraversal
join two PLens with the same target
join two PLens with the same target
compose a PLens with a PTraversal
compose a PLens with a PTraversal
pair two disjoint PLens
pair two disjoint PLens
(Since version 1.2.0) use split
(Since version 1.2.0) use choice
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 set requires an additional parameter than reverseGet.
PLens stands for Polymorphic Lens as it set and modify methods change a type
A
toB
andS
toT
. 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 it is component.
the source of a PLens
the modified source of a PLens
the target of a PLens
the modified target of a PLens
monocle.law.LensLaws