compdata-param-0.9: Parametric Compositional Data Types

Copyright(c) 2011 Patrick Bahr, Tom Hvitved
LicenseBSD3
MaintainerTom Hvitved <hvitved@diku.dk>
Stabilityexperimental
Portabilitynon-portable (GHC Extensions)
Safe HaskellSafe-Inferred
LanguageHaskell98

Data.Comp.Param.Multi.HDifunctor

Description

This module defines higher-order difunctors, a hybrid between higher-order functors (Johann, Ghani, POPL '08), and difunctors (Meijer, Hutton, FPCA '95). Higher-order difunctors are used to define signatures for compositional parametric generalised data types.

Synopsis

Documentation

class HDifunctor f where Source

This class represents higher-order difunctors.

Methods

hdimap :: (a :-> b) -> (c :-> d) -> f b c :-> f a d Source

Instances

class HFunctor h where

This class represents higher-order functors (Johann, Ghani, POPL '08) which are endofunctors on the category of endofunctors.

Methods

hfmap :: (:->) f g -> (:->) (h f) (h g)

A higher-order functor f also maps a natural transformation g :-> h to a natural transformation f g :-> f h

Instances

HDifunctor f => HFunctor (f a)

A higher-order difunctor gives rise to a higher-order functor when restricted to a particular contravariant argument.

Functor f => HFunctor (Compose f) 

newtype I a :: * -> *

The identity Functor.

Constructors

I 

Fields

unI :: a
 

newtype K a i :: * -> * -> *

The parametrised constant functor.

Constructors

K 

Fields

unK :: a
 

Instances

Functor (K a) 
Foldable (K a) 
Traversable (K a) 
Eq a => PEq (K a) 
Ord a => POrd (K a) 
Eq a => Eq (K a i) 
Ord a => Ord (K a i) 

data E f :: (* -> *) -> * where

Constructors

E :: f i -> E f 

Fields

unE :: f i
 

data A f :: (* -> *) -> *

Constructors

A 

Fields

unA :: forall i. f i
 

type (:->) f g = forall i. f i -> g i infixr 0

This type represents natural transformations.

type NatM m f g = forall i. f i -> m (g i)