representable-functors-3.1: Representable functors

Stabilityexperimental
Maintainerekmett@gmail.com
Safe HaskellNone

Data.Functor.Contravariant.Representable

Contents

Description

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

Synopsis

Values

type family Value f Source

Contravariant Keyed

class Contravariant f => Valued f whereSource

Dual to Keyed.

Methods

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

Instances

Contravariant Indexed

class Coindexed f whereSource

Dual to Indexed.

Methods

coindex :: f a -> a -> Value fSource

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).

Methods

contrarep :: (a -> Value f) -> f aSource

 contramap f (contrarep g) = contrarep (g . f)

Default definitions

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

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