Stability | experimental |
---|---|

Maintainer | ekmett@gmail.com |

Safe Haskell | None |

Representable contravariant endofunctors over the category of Haskell
types are isomorphic to `(_ -> r)`

and resemble mappings to a
fixed range.

- type family Value f
- class Contravariant f => Valued f where
- contramapWithValue :: (b -> Either a (Value f)) -> f a -> f b

- class Coindexed f where
- class (Coindexed f, Valued f) => Corepresentable f where
- contramapDefault :: Corepresentable f => (a -> b) -> f b -> f a
- contramapWithValueDefault :: Corepresentable f => (b -> Either a (Value f)) -> f a -> f b

# Values

# Contravariant Keyed

class Contravariant f => Valued f whereSource

Dual to `Keyed`

.

contramapWithValue :: (b -> Either a (Value f)) -> f a -> f bSource

# Contravariant Indexed

Dual to `Indexed`

.

# Representable Contravariant Functors

class (Coindexed f, Valued f) => Corepresentable f whereSource

A `Functor`

`f`

is `Corepresentable`

if `corep`

and `coindex`

witness an isomorphism to `(_ -> Value f)`

.

tabulate . index = id index . tabulate = id tabulate . return f = return f

Corepresentable Predicate | |

(Coindexed (Op r), Valued (Op r)) => Corepresentable (Op r) | |

(Coindexed (Product f g), Valued (Product f g), Corepresentable f, Corepresentable g) => Corepresentable (Product f g) |

# Default definitions

contramapDefault :: Corepresentable f => (a -> b) -> f b -> f aSource

contramapWithValueDefault :: Corepresentable f => (b -> Either a (Value f)) -> f a -> f bSource