Documentation
type :~> f a = MaybeLens f aSource
Lens type for situations in which the accessor functions can fail. This is useful, for example, when accessing fields in datatypes with multiple constructors.
lens :: (f -> Maybe a) -> (a -> f -> Maybe f) -> f :~> aSource
Create a lens that can fail from a getter and a setter that can themselves potentially fail.
get :: (f :~> a) -> f -> Maybe aSource
Getter for a lens that can fail. When the field to which the lens points
is not accessible the getter returns Nothing
.
set :: (f :~> a) -> a -> f -> Maybe fSource
Setter for a lens that can fail. When the field to which the lens points
is not accessible this function returns Nothing
.