fclabels-1.1.4.3: First class accessor labels.

Safe Haskell | Safe-Inferred

Data.Label.Pure

Synopsis

- type :-> f a = PureLens f a
- lens :: (f -> a) -> (a -> f -> f) -> f :-> a
- get :: (f :-> a) -> f -> a
- set :: (f :-> a) -> a -> f -> f
- modify :: (f :-> a) -> (a -> a) -> f -> f

# Documentation

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.