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

Data.Record.Label.Core

Synopsis

Documentation

data Point f i o Source

Constructors

Point 

Fields

_get :: f -> o
 
_set :: i -> f -> f
 

Instances

_mod :: Point f i o -> (o -> i) -> f -> fSource

newtype f :-> a Source

Constructors

Lens 

Fields

unLens :: Point f a a
 

Instances

lens :: (f -> a) -> (a -> f -> f) -> f :-> aSource

Create a lens out of a getter and setter.

getL :: (f :-> a) -> f -> aSource

Get the getter function from a lens.

setL :: (f :-> a) -> a -> f -> fSource

Get the setter function from a lens.

modL :: (f :-> a) -> (a -> a) -> f -> fSource

Get the modifier function from a lens.

fmapL :: Applicative f => (a :-> b) -> f a :-> f bSource

class Iso f whereSource

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

Methods

(%) :: (a :<->: b) -> f a -> f bSource

Instances

Iso (:<->: i) 
Iso (:-> i) 

data a :<->: b Source

The bijections datatype, a function that works in two directions.

Constructors

:<->: 

Fields

fw :: a -> b
 
bw :: b -> a
 

Instances

Category :<->:

Constructor for bijections.

Iso (:<->: i) 

lmap :: Functor f => (a :<->: b) -> f a :<->: f bSource

dimap :: (o' -> o) -> (i -> i') -> Point f i' o' -> Point f i oSource

for :: (i -> o) -> (f :-> o) -> Point f i oSource

Combine a partial destructor with a lens into something easily used in the applicative instance for the hidden Point datatype. Internally uses the covariant in getter, contravariant in setter bi-functioral-map function. (Please refer to the example because this function is just not explainable on its own.)