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) => Representable f where
- contramapDefault :: Representable f => (a -> b) -> f b -> f a
- contramapWithValueDefault :: Representable 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) => Representable f whereSource

A `Contravariant`

functor `f`

is `Representable`

if `contrarep`

and `coindex`

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

.

Representable Predicate | |

Representable (Op r) | |

(Representable f, Representable g) => Representable (Product f g) |

# Default definitions

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

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