Portability | non-portable |
---|---|

Stability | provisional |

Maintainer | Edward Kmett <ekmett@gmail.com> |

Safe Haskell | Safe-Inferred |

- type Projection a b c d = forall k f. (Projective k a d, Applicative f) => k (c -> f d) (a -> f a)
- class Projective k a d where
- projective :: (d -> a) -> (x -> y) -> k x y

- project :: Projective k a d => Overloaded (Project a d) f a a c d -> Overloaded k f a a c d
- by :: Project a d (d -> Identity d) (a -> Identity a) -> Getter d a
- data Project a d x y = Project (d -> a) (x -> y)
- projection :: (d -> a) -> (a -> Maybe c) -> Projection a b c d
- stereo :: Projective k a c => Project b c y z -> Project a b x y -> k x z
- mirror :: Projective k a c => Simple Iso a c -> Simple Projection a c
- type SimpleProjection a b = Projection a a b b

# 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.

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

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

A concrete `Projection`

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

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

(~ * 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

type SimpleProjection a b = Projection a a b bSource

type`SimpleProjection`

=`Simple`

`Projection`