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

Stability | provisional |

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

Safe Haskell | Safe-Inferred |

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

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

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

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

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

A concrete `Projection`

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

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

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

type SimpleProjection s a = Projection s s a aSource

type`SimpleProjection`

=`Simple`

`Projection`