lens-2.9: Lenses, Folds and Traversals

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

Control.Lens.Projection

Contents

Description

 

Synopsis

Documentation

type Projection a b c d = forall k f. (Projective k a d, Applicative f) => k (c -> f d) (a -> f a)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 
(~ * a a', ~ * d d') => Projective (Project a d) a' d' 

project :: Projective k a d => Overloaded (Project a d) f a a c d -> Overloaded k f a a c dSource

Reflect a Projection.

by :: Project a d (d -> Identity d) (a -> Identity a) -> Getter d aSource

Turn a Projection around to get an embedding

data Project a d x y Source

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

Constructors

Project (d -> a) (x -> y) 

Instances

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

projection :: (d -> a) -> (a -> Maybe c) -> Projection a b c dSource

Build a Projection

stereo :: Projective k a c => Project b c y z -> Project a b x y -> k x zSource

Compose projections.

mirror :: Projective k a c => Simple Iso a c -> Simple Projection a cSource

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