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

Data.Label.Point

Description

The Point data type which generalizes the different lenses and forms the basis for vertical composition using the Applicative type class.

Synopsis

# The point data type that generalizes lens.

data Point cat g i f o Source #

Abstract Point datatype. The getter and modifier operations work in some category. The type of the value pointed to might change, thereby changing the type of the outer structure.

Constructors

 Point (cat f o) (cat (cat o i, f) g)
Instances
 Arrow arr => Functor (Point arr f i f) Source # Instance detailsDefined in Data.Label.Point Methodsfmap :: (a -> b) -> Point arr f i f a -> Point arr f i f b #(<\$) :: a -> Point arr f i f b -> Point arr f i f a # Arrow arr => Applicative (Point arr f i f) Source # Instance detailsDefined in Data.Label.Point Methodspure :: a -> Point arr f i f a #(<*>) :: Point arr f i f (a -> b) -> Point arr f i f a -> Point arr f i f b #liftA2 :: (a -> b -> c) -> Point arr f i f a -> Point arr f i f b -> Point arr f i f c #(*>) :: Point arr f i f a -> Point arr f i f b -> Point arr f i f b #(<*) :: Point arr f i f a -> Point arr f i f b -> Point arr f i f a # Alternative (Point Partial f view f) Source # Instance detailsDefined in Data.Label.Point Methodsempty :: Point Partial f view f a #(<|>) :: Point Partial f view f a -> Point Partial f view f a -> Point Partial f view f a #some :: Point Partial f view f a -> Point Partial f view f [a] #many :: Point Partial f view f a -> Point Partial f view f [a] #

get :: Point cat g i f o -> cat f o Source #

Get the getter category from a Point.

modify :: Point cat g i f o -> cat (cat o i, f) g Source #

Get the modifier category from a Point.

set :: Arrow arr => Point arr g i f o -> arr (i, f) g Source #

Get the setter category from a Point.

identity :: ArrowApply arr => Point arr f f o o Source #

Identity Point. Cannot change the type.

compose :: ArrowApply cat => Point cat t i b o -> Point cat g t f b -> Point cat g i f o Source #

Point composition.

# Working with isomorphisms.

data Iso cat i o infix 8 Source #

An isomorphism is like a Category that works in two directions.

Constructors

 Iso infix 8 Fieldsfw :: cat i o bw :: cat o i
Instances
 Category cat => Category (Iso cat :: Type -> Type -> Type) Source # Isomorphisms are categories. Instance detailsDefined in Data.Label.Point Methodsid :: Iso cat a a #(.) :: Iso cat b c -> Iso cat a b -> Iso cat a c #

inv :: Iso cat i o -> Iso cat o i Source #

Flip an isomorphism.

# Specialized lens contexts.

type Total = (->) Source #

Context that represents computations that always produce an output.

Context that represents computations that might silently fail.

type Failing e = Kleisli (Either e) Source #

Context that represents computations that might fail with some error.

# Arrow type class for failing with some error.

class Arrow a => ArrowFail e a where Source #

The ArrowFail class is similar to ArrowZero, but additionally embeds some error value in the computation instead of throwing it away.

Methods

failArrow :: a e c Source #

Instances
 Source # Instance detailsDefined in Data.Label.Point Methods ArrowFail e (Failing e) Source # Instance detailsDefined in Data.Label.Point MethodsfailArrow :: Failing e e c Source #