Copyright | (c) 2011 Patrick Bahr |
---|---|

License | BSD3 |

Maintainer | Patrick Bahr <paba@diku.dk> |

Stability | experimental |

Portability | non-portable (GHC Extensions) |

Safe Haskell | Safe |

Language | Haskell98 |

This module defines higher-order functors (Johann, Ghani, POPL '08), i.e. endofunctors on the category of endofunctors.

## Synopsis

- class HFunctor h where
- type (:->) f g = forall i. f i -> g i
- type (:=>) f a = forall i. f i -> a
- type NatM m f g = forall i. f i -> m (g i)
- newtype I a = I {
- unI :: a

- newtype K a i = K {
- unK :: a

- data A f = A {
- unA :: forall i. f i

- data E f = forall i. E {
- unE :: f i

- runE :: (f :=> b) -> E f -> b
- rewriteE :: (forall l. f l -> f l) -> E f -> E f
- rewriteEM :: Functor m => (forall l. f l -> m (f l)) -> E f -> m (E f)
- data (f :.: (g :: (* -> *) -> * -> *)) (e :: * -> *) t = Comp (f (g e) t)
- newtype HMonad m f i = HMonad {
- unHMonad :: m (f i)

# Documentation

class HFunctor h where Source #

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 Source #

A higher-order functor `f`

also maps a natural transformation
`g :-> h`

to a natural transformation `f g :-> f h`

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

This type represents natural transformations.

type (:=>) f a = forall i. f i -> a infixr 0 Source #

This type represents co-cones from `f`

to `a`

. `f :=> a`

is
isomorphic to f :-> K a

The identity Functor.

#### Instances

Functor I Source # | |

Foldable I Source # | |

Defined in Data.Comp.Multi.HFunctor fold :: Monoid m => I m -> m # foldMap :: Monoid m => (a -> m) -> I a -> 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 Source # | |

The parametrised constant functor.

#### Instances

Functor (K a) Source # | |

Foldable (K a) Source # | |

Defined in Data.Comp.Multi.HFunctor fold :: Monoid m => K a m -> m # foldMap :: Monoid m => (a0 -> m) -> K a a0 -> 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) Source # | |

Eq a => KEq (K a) Source # | |

Ord a => KOrd (K a) Source # | |

KShow (K ()) Source # | |

KShow (K String) Source # | |

Eq a => Eq (K a i) Source # | |

Ord a => Ord (K a i) Source # | |

Generic (f (HFix f) l) => Generic (HFix f l) Source # | |

type Rep (HFix f l) Source # | |

Defined in Data.Comp.Multi.Derive.Generic |