Type
type Lens s t a b = forall f. Functor f => (a -> f b) -> s -> f t Source #
A reference updating structures from s to t and fields from a to b
Construction
lens :: (s -> a) -> (s -> b -> t) -> Lens s t a b Source #
Make a lens from a getter and a setter
Operations
view :: Lens s t a b -> s -> a Source #
Fetch the field referenced by a lens from a structure
over :: Lens s t a b -> (a -> b) -> s -> t Source #
Update the field referenced by a lens with an operation on a structure
set :: Lens s t a b -> b -> s -> t Source #
Overwrite the field referenced by a lens with a value on a structure