adjunctions-4.4.2: Adjunctions and representable functors
Copyright(c) Edward Kmett 2011-2014
LicenseBSD3
Maintainerekmett@gmail.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

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.

Synopsis

Representable Contravariant Functors

class Contravariant f => Representable (f :: Type -> Type) 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 :: Type -> Type) 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 #

Instances

Instances details
Representable Predicate Source # 
Instance details

Defined in Data.Functor.Contravariant.Rep

Associated Types

type Rep Predicate 
Instance details

Defined in Data.Functor.Contravariant.Rep

Representable (Op r) Source # 
Instance details

Defined in Data.Functor.Contravariant.Rep

Associated Types

type Rep (Op r) 
Instance details

Defined in Data.Functor.Contravariant.Rep

type Rep (Op r) = r

Methods

tabulate :: (a -> Rep (Op r)) -> Op r a Source #

index :: Op r a -> a -> Rep (Op r) Source #

contramapWithRep :: (b -> Either a (Rep (Op r))) -> Op r a -> Op r b Source #

Representable (Proxy :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Contravariant.Rep

Associated Types

type Rep (Proxy :: Type -> Type) 
Instance details

Defined in Data.Functor.Contravariant.Rep

type Rep (Proxy :: Type -> Type) = ()

Methods

tabulate :: (a -> Rep (Proxy :: Type -> Type)) -> Proxy a Source #

index :: Proxy a -> a -> Rep (Proxy :: Type -> Type) Source #

contramapWithRep :: (b -> Either a (Rep (Proxy :: Type -> Type))) -> Proxy a -> Proxy b Source #

Representable (U1 :: Type -> Type) Source # 
Instance details

Defined in Data.Functor.Contravariant.Rep

Associated Types

type Rep (U1 :: Type -> Type) 
Instance details

Defined in Data.Functor.Contravariant.Rep

type Rep (U1 :: Type -> Type) = ()

Methods

tabulate :: (a -> Rep (U1 :: Type -> Type)) -> U1 a Source #

index :: U1 a -> a -> Rep (U1 :: Type -> Type) Source #

contramapWithRep :: (b -> Either a (Rep (U1 :: Type -> Type))) -> U1 a -> U1 b Source #

(Representable f, Representable g) => Representable (Product f g) Source # 
Instance details

Defined in Data.Functor.Contravariant.Rep

Associated Types

type Rep (Product f g) 
Instance details

Defined in Data.Functor.Contravariant.Rep

type Rep (Product f g) = (Rep f, Rep g)

Methods

tabulate :: (a -> Rep (Product f g)) -> Product f g a Source #

index :: Product f g a -> a -> Rep (Product f g) Source #

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

(Representable f, Representable g) => Representable (f :*: g) Source # 
Instance details

Defined in Data.Functor.Contravariant.Rep

Associated Types

type Rep (f :*: g) 
Instance details

Defined in Data.Functor.Contravariant.Rep

type Rep (f :*: g) = (Rep f, Rep g)

Methods

tabulate :: (a -> Rep (f :*: g)) -> (f :*: g) a Source #

index :: (f :*: g) a -> a -> Rep (f :*: g) Source #

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

tabulated :: (Representable f, Representable g, Profunctor p, Functor h) => p (f a) (h (g b)) -> p (a -> Rep f) (h (b -> Rep g)) Source #

tabulate and index form two halves of an isomorphism.

This can be used with the combinators from the lens package.

tabulated :: Representable f => Iso' (a -> Rep f) (f a)

Default definitions

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