Portability | Rank2Types |
---|---|

Stability | provisional |

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

Safe Haskell | Trustworthy |

- class Functor f => Gettable f where
- coerce :: f a -> f b

- noEffect :: (Applicative f, Gettable f) => f a
- class (Monad m, Gettable f) => Effective m r f | f -> m r where
- effective :: m r -> f a
- ineffective :: f a -> m r

- class Applicative f => Settable f where
- untainted :: f a -> a
- untainted# :: (a -> f b) -> a -> b
- tainted# :: (a -> b) -> a -> f b

- class Category k => Isomorphic k where
- class Isomorphic k => Prismatic k where
- prism :: Applicative f => (b -> t) -> (s -> Either t a) -> k (a -> f b) (s -> f t)

- class Indexable i k where
- indexed :: ((i -> a) -> b) -> k a b

# Getters

class Functor f => Gettable f whereSource

Generalizing `Const`

so we can apply simple `Applicative`

transformations to it and so we can get nicer error messages

A `Gettable`

`Functor`

ignores its argument, which it carries solely as a
phantom type parameter.

To ensure this, an instance of `Gettable`

is required to satisfy:

`id`

=`fmap`

f =`coerce`

Which is equivalent to making a

an "anyvariant" functor.
`Gettable`

f

Functor (Const r) => Gettable (Const r) | |

(Functor (Backwards f), Gettable f) => Gettable (Backwards f) | |

Functor (Accessor r) => Gettable (Accessor r) | |

(Functor (Indexing64 f), Gettable f) => Gettable (Indexing64 f) | |

(Functor (Indexing f), Gettable f) => Gettable (Indexing f) | |

(Functor (Compose f g), Functor f, Gettable g) => Gettable (Compose f g) | |

Functor (Effect m r) => Gettable (Effect m r) | |

(Functor (BazaarT a b g), Gettable g) => Gettable (BazaarT a b g) | |

Functor (EffectRWS w st m s) => Gettable (EffectRWS w st m s) |

noEffect :: (Applicative f, Gettable f) => f aSource

The `mempty`

equivalent for a `Gettable`

`Applicative`

`Functor`

.

# Actions

class (Monad m, Gettable f) => Effective m r f | f -> m r whereSource

An `Effective`

`Functor`

ignores its argument and is isomorphic to a `Monad`

wrapped around a value.

That said, the `Monad`

is possibly rather unrelated to any `Applicative`

structure.

ineffective :: f a -> m rSource

# Setters

class Applicative f => Settable f whereSource

untainted# :: (a -> f b) -> a -> bSource

# Isomorphisms

class Category k => Isomorphic k whereSource

Used to provide overloading of isomorphism application

An instance of `Isomorphic`

is a `Category`

with a canonical mapping to it from the
category of isomorphisms over Haskell types.

# Prisms

class Isomorphic k => Prismatic k whereSource

Used to provide overloading of prisms.

An instance of `Prismatic`

is a `Category`

with a canonical mapping to it from the category
of embedding-projection pairs over Haskell types.

prism :: Applicative f => (b -> t) -> (s -> Either t a) -> k (a -> f b) (s -> f t)Source