fclabels-1.1.0.1: First class accessor labels.

Data.Label.Pure

Synopsis

type :-> f a = PureLens f aSource

Pure lens type specialized for pure accessor functions.

lens :: (f -> a) -> (a -> f -> f) -> f :-> aSource

Create a pure lens from a getter and a setter.

We expect the following law to hold:

get l (set l a f) == a

Or, equivalently:

set l (get l f) f == f

get :: (f :-> a) -> f -> aSource

Getter for a pure lens.

set :: (f :-> a) -> a -> f -> fSource

Setter for a pure lens.

modify :: (f :-> a) -> (a -> a) -> f -> fSource

Modifier for a pure lens.