fclabels-1.1.7.1: First class accessor labels.

Safe HaskellSafe-Inferred

Data.Label.Abstract

Synopsis

Documentation

data Point arr f i o Source

Abstract Point datatype. The getter and setter functions work in some arrow.

Constructors

Point 

Fields

_get :: f `arr` o
 
_set :: (i, f) `arr` f
 

Instances

Arrow arr => Functor (Point arr f i) 
Arrow arr => Applicative (Point arr f i) 

_modify :: ArrowApply arr => Point arr f i o -> (o `arr` i, f) `arr` fSource

Modification as a compositon of a getter and setter. Unfortunately, ArrowApply is needed for this composition.

newtype Lens arr f a Source

Abstract Lens datatype. The getter and setter functions work in some arrow. Arrows allow for effectful lenses, for example, lenses that might fail or use state.

Constructors

Lens 

Fields

unLens :: Point arr f a a
 

Instances

Arrow arr => Iso arr (Lens arr f)

We can diverge Lenses using an isomorphism.

ArrowApply arr => Category (Lens arr) 

lens :: (f `arr` a) -> ((a, f) `arr` f) -> Lens arr f aSource

Create a lens out of a getter and setter.

get :: Arrow arr => Lens arr f a -> f `arr` aSource

Get the getter arrow from a lens.

set :: Arrow arr => Lens arr f a -> (a, f) `arr` fSource

Get the setter arrow from a lens.

modify :: ArrowApply arr => Lens arr f o -> (o `arr` o, f) `arr` fSource

Get the modifier arrow from a lens.

bimap :: Arrow arr => (o' `arr` o) -> (i `arr` i') -> Point arr f i' o' -> Point arr f i oSource

Make a Point diverge in two directions.

for :: Arrow arr => (i `arr` o) -> Lens arr f o -> Point arr f i oSource

data Bijection arr a b Source

The bijections datatype, an arrow that works in two directions.

Constructors

Bij 

Fields

fw :: a `arr` b
 
bw :: b `arr` a
 

Instances

Arrow arr => Iso arr (Bijection arr a)

We can diverge Bijections using an isomorphism.

Category arr => Category (Bijection arr)

Bijections as categories.

liftBij :: Functor f => Bijection (->) a b -> Bijection (->) (f a) (f b)Source

Lifting Bijections.

class Iso arr f whereSource

The isomorphism type class is like a Functor but works in two directions.

Methods

iso :: Bijection arr a b -> f a `arr` f bSource

Instances

Arrow arr => Iso arr (Bijection arr a)

We can diverge Bijections using an isomorphism.

Arrow arr => Iso arr (Lens arr f)

We can diverge Lenses using an isomorphism.

osi :: Iso arr f => Bijection arr b a -> f a `arr` f bSource

Flipped isomorphism.