Copyright | (c) 2011 Patrick Bahr |
---|---|
License | BSD3 |
Maintainer | Patrick Bahr <paba@diku.dk> |
Stability | experimental |
Portability | non-portable (GHC Extensions) |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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
- data (f :.: (g :: (Type -> Type) -> Type -> Type)) (e :: Type -> Type) t = Comp (f (g e) t)
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
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 # | |
Functor I Source # | |
The parametrised constant functor.
Instances
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 # | |
Functor (K a) Source # | |
KShow (K String) Source # | |
KShow (K ()) Source # | |
Eq a => KEq (K a) Source # | |
Ord a => KOrd (K a) Source # | |
Eq a => Eq (K a i) Source # | |
Ord a => Ord (K a i) Source # | |