data-lens-2.0.4: Haskell 98 Lenses

Safe HaskellSafe-Infered

Data.Lens.Common

Contents

Synopsis

Documentation

newtype Lens a b Source

Constructors

Lens 

Fields

runLens :: a -> Store b a
 

Lens construction

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

build a lens out of a getter and setter

iso :: (a -> b) -> (b -> a) -> Lens a bSource

build a lens out of an isomorphism

Functional API

getL :: Lens a b -> a -> bSource

Gets the getter function from a lens.

setL :: Lens a b -> b -> a -> aSource

Gets the setter function from a lens.

modL :: Lens a b -> (b -> b) -> a -> aSource

Gets the modifier function from a lens.

Operator API

(^$), (^$!) :: Lens a b -> a -> bSource

(^.), (^!) :: a -> Lens a b -> bSource

functional getter, which acts like a field accessor

(^=), (^!=) :: Lens a b -> b -> a -> aSource

(^%=), (^!%=) :: Lens a b -> (b -> b) -> a -> aSource

functional modify

(^%%=) :: Functor f => Lens a b -> (b -> f b) -> a -> f aSource

functorial modify

Pseudo-imperatives

(^+=), (^!*=), (^*=), (^!-=), (^-=), (^!+=) :: Num b => Lens a b -> b -> a -> aSource

(^/=), (^!/=) :: Fractional b => Lens a b -> b -> a -> aSource

Stock lenses

fstLens :: Lens (a, b) aSource

sndLens :: Lens (a, b) bSource

mapLens :: Ord k => k -> Lens (Map k v) (Maybe v)Source

setLens :: Ord k => k -> Lens (Set k) BoolSource