fclabels-2.0.3.3: First class accessor labels implemented as lenses.

Safe HaskellNone
LanguageHaskell98

Data.Label.Base

Contents

Description

Labels for data types in the base package. The lens types are kept abstract to be fully reusable in custom contexts. Build to be imported qualified.

Synopsis

Lenses for lists.

head :: (ArrowZero arr, ArrowApply arr, ArrowChoice arr) => Lens arr [a] a Source #

Lens pointing to the head of a list's cons cell. (Partial and monomorphic)

tail :: (ArrowZero arr, ArrowApply arr, ArrowChoice arr) => Lens arr [a] [a] Source #

Lens pointing to the tail of a list's cons cell. (Partial and monomorphic)

Lenses for Either.

left :: (ArrowZero arr, ArrowApply arr, ArrowChoice arr) => Lens arr (Either a b -> Either o b) (a -> o) Source #

Lens pointing to the left value in an Either. (Partial and polymorphic)

right :: (ArrowZero arr, ArrowApply arr, ArrowChoice arr) => Lens arr (Either a b -> Either a o) (b -> o) Source #

Lens pointing to the right value in an Either. (Partial and polymorphic)

Lens for Maybe.

just :: (ArrowChoice cat, ArrowZero cat, ArrowApply cat) => Lens cat (Maybe a -> Maybe b) (a -> b) Source #

Lens pointing to the value in a Maybe. (Partial and polymorphic)

Lenses for 2-tuples.

fst :: ArrowApply arr => Lens arr ((a, b) -> (o, b)) (a -> o) Source #

Lens pointing to the first component of a 2-tuple. (Total and polymorphic)

snd :: ArrowApply arr => Lens arr ((a, b) -> (a, o)) (b -> o) Source #

Lens pointing to the second component of a 2-tuple. (Total and polymorphic)

swap :: ArrowApply arr => Lens arr ((a, b) -> (c, d)) ((b, a) -> (d, c)) Source #

Polymorphic lens that swaps the components of a tuple. (Total and polymorphic)

Lenses for 3-tuples.

fst3 :: ArrowApply arr => Lens arr ((a, b, c) -> (o, b, c)) (a -> o) Source #

Lens pointing to the first component of a 3-tuple. (Total and polymorphic)

snd3 :: ArrowApply arr => Lens arr ((a, b, c) -> (a, o, c)) (b -> o) Source #

Lens pointing to the second component of a 3-tuple. (Total and polymorphic)

trd3 :: ArrowApply arr => Lens arr ((a, b, c) -> (a, b, o)) (c -> o) Source #

Lens pointing to the third component of a 3-tuple. (Total and polymorphic)

Read/Show isomorphism.

readShow :: (Read a, Show a) => Iso Partial String a Source #

Partial isomorphism for readable and showable values. Can easily be lifted into a lens by using iso.