hackage-security-0.5.2.2: Hackage security library

Safe Haskell | None
Language | Haskell2010

Hackage.Security.Util.Lens

Contents

- Generic definitions
- Specific lenses

Description

Some very simple lens definitions (to avoid further dependencies)

Intended to be double-imported > import Hackage.Security.Util.Lens (Lens) > import qualified Hackage.Security.Util.Lens as Lens

Synopsis

- type Lens s t a b = forall f. Functor f => (a -> f b) -> s -> f t
- type Lens' s a = Lens s s a a
- get :: Lens' s a -> s -> a
- modify :: Lens s t a b -> (a -> b) -> s -> t
- set :: Lens s t a b -> b -> s -> t
- lookupM :: forall a b. (Eq a, Monoid b) => a -> Lens' [(a, b)] b

# Generic definitions

type Lens s t a b = forall f. Functor f => (a -> f b) -> s -> f t #

Polymorphic lens

type Lens' s a = Lens s s a a #

Monomorphic lens

get :: Lens' s a -> s -> a #

modify :: Lens s t a b -> (a -> b) -> s -> t #

set :: Lens s t a b -> b -> s -> t #

# Specific lenses

lookupM :: forall a b. (Eq a, Monoid b) => a -> Lens' [(a, b)] b #