adjunctions-4.0: Adjunctions and representable functors

Copyright(c) Edward Kmett 2011-2014
LicenseBSD3
Maintainerekmett@gmail.com
Stabilityexperimental
Safe HaskellSafe-Inferred
LanguageHaskell98

Data.Functor.Contravariant.Rep

Contents

Description

Representable contravariant endofunctors over the category of Haskell types are isomorphic to (_ -> r) and resemble mappings to a fixed range.

Synopsis

Representable Contravariant Functors

class Contravariant f => Representable f where Source

A Contravariant functor f is Representable if tabulate and index witness an isomorphism to (_ -> Rep f).

tabulate . index ≡ id
index . tabulate ≡ id

Minimal complete definition

tabulate, index

Associated Types

type Rep f :: * Source

Methods

tabulate :: (a -> Rep f) -> f a Source

contramap f (tabulate g) = tabulate (g . f)

index :: f a -> a -> Rep f Source

contramapWithRep :: (b -> Either a (Rep f)) -> f a -> f b Source

Default definitions

contramapRep :: Representable f => (a -> b) -> f b -> f a Source