lens-family-0.0.0: Lens Families

Safe HaskellSafe-Infered

Lens.Family2.Stock

Contents

Description

This module contains lenses for common structures in Haskell. It also contains the lens combinators mergeL and ***.

Synopsis

Lens Combinators

mergeL :: Functor f => LensFamily f a a' c c' -> LensFamily f b b' c c' -> LensFamily f (Either a b) (Either a' b') c c'

Given two lens/getter/setter families with the same substructure, make a new lens/getter/setter on Either.

(***) :: LensFamily a1 a1' b1 b1' -> LensFamily a2 a2' b2 b2' -> LensFamily (a1, a2) (a1', a2') (b1, b2) (b1', b2')Source

Given two lens families, make a new lens on their product.

Stock Lenses

fstL :: LensFamily (a, b) (a', b) a a'Source

Lens on the first element of a pair.

sndL :: LensFamily (a, b) (a, b') b b'Source

Lens on the second element of a pair.

funL :: Eq k => k -> Lens (k -> v) vSource

Lens on a given point of a function.

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

Lens on a given point of a Map.

intMapL :: Int -> Lens (IntMap v) (Maybe v)Source

Lens on a given point of a IntMap.

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

Lens on a given point of a Set.

intSetL :: Int -> Lens IntSet BoolSource

Lens on a given point of a IntSet.

Types

type LensFamily a a' b b' = forall f. Functor f => LensFamily f a a' b b'Source

type Lens a b = LensFamily a a b bSource