Copyright | (c) 2011 Patrick Bahr Tom Hvitved |
---|---|
License | BSD3 |
Maintainer | Tom Hvitved <hvitved@diku.dk> |
Stability | experimental |
Portability | non-portable (GHC Extensions) |
Safe Haskell | Safe |
Language | Haskell98 |
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
- class HDifunctor f where
- class HFunctor (h :: (* -> *) -> * -> *) where
- newtype I a = I {
- unI :: a
- newtype K a i = K {
- unK :: a
- data E (f :: * -> *) where
- data A (f :: * -> *) = A {
- unA :: forall i. f i
- type (:->) (f :: * -> *) (g :: * -> *) = forall i. f i -> g i
- type NatM (m :: * -> *) (f :: * -> *) (g :: * -> *) = forall i. f i -> m (g i)
Documentation
class HDifunctor f where Source #
This class represents higher-order difunctors.
Instances
HDifunctor f => HDifunctor (f :&: p) Source # | |
(HDifunctor f, HDifunctor g) => HDifunctor (f :+: g) Source # | |
class HFunctor (h :: (* -> *) -> * -> *) where #
This class represents higher-order functors (Johann, Ghani, POPL '08) which are endofunctors on the category of endofunctors.
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
The identity Functor.
Instances
Functor I | |
Foldable I | |
Defined in Data.Comp.Multi.HFunctor fold :: Monoid m => I m -> m # foldMap :: Monoid m => (a -> m) -> I a -> m # foldr :: (a -> b -> b) -> b -> I a -> b # foldr' :: (a -> b -> b) -> b -> I a -> b # foldl :: (b -> a -> b) -> b -> I a -> b # foldl' :: (b -> a -> b) -> b -> I a -> b # foldr1 :: (a -> a -> a) -> I a -> a # foldl1 :: (a -> a -> a) -> I a -> a # elem :: Eq a => a -> I a -> Bool # maximum :: Ord a => I a -> a # | |
Traversable I | |
The parametrised constant functor.
Instances
Functor (K a) | |
Foldable (K a) | |
Defined in Data.Comp.Multi.HFunctor fold :: Monoid m => K a m -> m # foldMap :: Monoid m => (a0 -> m) -> K a a0 -> m # foldr :: (a0 -> b -> b) -> b -> K a a0 -> b # foldr' :: (a0 -> b -> b) -> b -> K a a0 -> b # foldl :: (b -> a0 -> b) -> b -> K a a0 -> b # foldl' :: (b -> a0 -> b) -> b -> K a a0 -> b # foldr1 :: (a0 -> a0 -> a0) -> K a a0 -> a0 # foldl1 :: (a0 -> a0 -> a0) -> K a a0 -> a0 # elem :: Eq a0 => a0 -> K a a0 -> Bool # maximum :: Ord a0 => K a a0 -> a0 # minimum :: Ord a0 => K a a0 -> a0 # | |
Traversable (K a) | |
Eq a => PEq (K a) Source # | |
Ord a => POrd (K a) Source # | |
Eq a => Eq (K a i) | |
Ord a => Ord (K a i) | |
type (:->) (f :: * -> *) (g :: * -> *) = forall i. f i -> g i infixr 0 #
This type represents natural transformations.