lens-3.2: Lenses, Folds and Traversals

Portabilitynon-portable
Stabilityprovisional
MaintainerEdward Kmett <ekmett@gmail.com>
Safe HaskellSafe-Inferred

Control.Lens.Projection

Contents

Description

 

Synopsis

Documentation

type Projection s t a b = forall k f. (Projective k s b, Applicative f) => k (a -> f b) (s -> f s)Source

A Projection is a Traversal that can also be turned around with by to obtain a Getter

class Projective k a d whereSource

Used to provide overloading of projections.

Methods

projective :: (d -> a) -> (x -> y) -> k x ySource

Instances

Projective (->) a d 
(~ * s s', ~ * b b') => Projective (Project s b) s' b' 

project :: Projective k s b => Overloaded (Project s b) f s s a b -> Overloaded k f s s a bSource

Reflect a Projection.

by :: Project s b (b -> Identity b) (s -> Identity s) -> Getter b sSource

Turn a Projection around to get an embedding

data Project s b x y Source

A concrete Projection, suitable for storing in a container or extracting an embedding.

Constructors

Project (b -> s) (x -> y) 

Instances

(~ * s s', ~ * b b') => Projective (Project s b) s' b' 

projection :: (b -> s) -> (s -> Maybe a) -> Projection s t a bSource

Build a Projection

stereo :: Projective k s a => Project t a y z -> Project s t x y -> k x zSource

Compose projections.

mirror :: Projective k s a => Simple Iso s a -> Simple Projection s aSource

Convert an Iso to a Projection.

Ideally we would be able to use an Iso directly as a Projection, but this opens a can of worms.

Simple