fclabels-1.0.2: First class accessor labels.

Data.Label.Abstract

Synopsis

Documentation

data Point (~>) f i o Source

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

Constructors

Point 

Fields

_get :: f ~> o
 
_set :: (i, f) ~> f
 

Instances

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

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

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

newtype Lens (~>) 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 ~> f a a
 

Instances

Arrow ~> => Iso ~> (Lens ~> f)

We can diverge Lenses using an isomorphism.

ArrowApply ~> => Category (Lens ~>) 

lens :: (f ~> a) -> ((a, f) ~> f) -> Lens ~> f aSource

Create a lens out of a getter and setter.

get :: Arrow ~> => Lens ~> f a -> f ~> aSource

Get the getter arrow from a lens.

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

Get the setter arrow from a lens.

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

Get the modifier arrow from a lens.

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

Make a Point diverge in two directions.

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

data Bijection (~>) a b Source

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

Constructors

Bij 

Fields

fw :: a ~> b
 
bw :: b ~> a
 

Instances

Arrow ~> => Iso ~> (Bijection ~> a)

We can diverge Bijections using an isomorphism.

Category ~> => Category (Bijection ~>)

Bijections as categories.

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

Lifting Bijections.

class Iso (~>) f whereSource

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

Methods

iso :: Bijection ~> a b -> f a ~> f bSource

Instances

Arrow ~> => Iso ~> (Bijection ~> a)

We can diverge Bijections using an isomorphism.

Arrow ~> => Iso ~> (Lens ~> f)

We can diverge Lenses using an isomorphism.