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

Safe Haskell | Safe
Language | Haskell98

Data.Label.Mono

Contents

- Specialized monomorphic lens operators.

Description

Lenses that only allow monomorphic updates. Monomorphic lenses are simply polymorphic lenses with the input and output type variables constraint to the same type.

Synopsis

- type Lens cat f o = Lens cat (f -> f) (o -> o)
- lens :: cat f o -> cat (cat o o, f) f -> Lens cat f o
- get :: Lens cat f o -> cat f o
- modify :: Lens cat f o -> cat (cat o o, f) f
- point :: Point cat f o f o -> Lens cat f o
- set :: Arrow arr => Lens arr f o -> arr (o, f) f
- iso :: ArrowApply cat => Iso cat f o -> Lens cat f o
- type (:->) f o = Lens Total f o
- type (:~>) f o = Lens Partial f o

# Documentation

type Lens cat f o = Lens cat (f -> f) (o -> o) Source #

Abstract monomorphic lens datatype. The getter and setter functions work in some category. Categories allow for effectful lenses, for example, lenses that might fail or use state.

lens Source #

Arguments

:: cat f o | Getter.
-> cat (cat o o, f) f | Modifier.
-> Lens cat f o |

Create a lens out of a getter and setter.

get :: Lens cat f o -> cat f o Source #

Get the getter arrow from a lens.

modify :: Lens cat f o -> cat (cat o o, f) f Source #

Get the modifier arrow from a lens.

point :: Point cat f o f o -> Lens cat f o Source #

Create lens from a `Point`.

set :: Arrow arr => Lens arr f o -> arr (o, f) f Source #

Get the setter arrow from a lens.

iso :: ArrowApply cat => Iso cat f o -> Lens cat f o Source #

Lift an isomorphism into a `Lens`.

# Specialized monomorphic lens operators.

type (:->) f o = Lens Total f o Source #

Total monomorphic lens.

type (:~>) f o = Lens Partial f o Source #

Partial monomorphic lens.