| Stability | experimental |
|---|---|
| Maintainer | ekmett@gmail.com |
| Safe Haskell | Safe-Inferred |
Data.Functor.Contravariant.Rep
Description
Representable contravariant endofunctors over the category of Haskell
types are isomorphic to (_ -> r) and resemble mappings to a
fixed range.
- class Contravariant f => Representable f where
- contramapRep :: Representable f => (a -> b) -> f b -> f a
Representable Contravariant Functors
class Contravariant f => Representable f whereSource
A Contravariant functor f is Representable if tabulate and index witness an isomorphism to (_ -> Rep f).
tabulate.index≡ idindex.tabulate≡ id
Methods
tabulate :: (a -> Rep f) -> f aSource
index :: f a -> a -> Rep fSource
contramapWithRep :: (b -> Either a (Rep f)) -> f a -> f bSource
contramapWithRepf p ≡tabulate$either(indexp)id. f
Instances
| Representable Predicate | |
| Representable (Op r) | |
| Representable (Proxy *) | |
| (Representable f, Representable g) => Representable (Day f g) | |
| (Representable f, Representable g) => Representable (Product f g) |
Default definitions
contramapRep :: Representable f => (a -> b) -> f b -> f aSource