get the target of a PPrism or nothing if there is no target
get the target of a PPrism or return the original value while allowing the type to change if it does not match
get the modified source of a PPrism
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 PPrism as a PTraversal
view a PPrism as a PTraversal
compose a PPrism with a PTraversal
compose a PPrism with a PTraversal
check if a PPrism has a target
check if a PPrism has a target
modify polymorphically the target of a PPrism with a function
modify polymorphically the target of a PPrism with a function
modify polymorphically the target of a PPrism with an Applicative function
modify polymorphically the target of a PPrism with an Applicative function
modify polymorphically the target of a PPrism with a function.
create a Getter from the modified target to the modified source of a PPrism
set polymorphically the target of a PPrism with a value
set polymorphically the target of a PPrism with a value
set polymorphically the target of a PPrism with a value.
(Since version 1.1.0) use getOption
(Since version 1.1.0) use modifyOption
(Since version 1.1.0) use setOption
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
toB
andS
toT
. 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
the source of a PPrism
the modified source of a PPrism
the target of a PPrism
the modified target of a PPrism
monocle.law.PrismLaws