Safe Haskell | Safe-Infered |
---|

- type :-> = LensM Identity
- lens :: (a -> b) -> (a -> b -> a) -> a :-> b
- get :: (a :-> b) -> a -> b
- set :: (a :-> b) -> a -> b -> a
- modify :: (a :-> b) -> (b -> b) -> a -> a
- type :~> = LensM Maybe
- lensM :: (a -> Maybe b) -> (a -> Maybe (b -> a)) -> a :~> b
- getM :: (a :~> b) -> a -> Maybe b
- setM :: (a :~> b) -> a -> b -> Maybe a
- modifyM :: (a :~> b) -> (b -> b) -> a -> Maybe a

# Documentation

This is a subset of `Lens`

, exporting only the basic API.
Furthermore, `get`

, `lensM`

, getM, setM, and modifyM are exported with
more restrictive types than are found in Data.Yall.Lens, for simplicity.

You should either import this module, or `Lens`

.

# Pure lenses

lens :: (a -> b) -> (a -> b -> a) -> a :-> bSource

Create a pure Lens from a getter and setter

lens g = lensM (fmap return g) . fmap (fmap return)

set :: (a :-> b) -> a -> b -> aSource

Run the getter function of a pure lens

set l b = runIdentity . setM l a

# Partial lenses

lensM :: (a -> Maybe b) -> (a -> Maybe (b -> a)) -> a :~> bSource

Create a partial lens from a getter and setter