compdata-param-0.9.2: Parametric Compositional Data Types

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

Data.Comp.Param.Multi.HDifunctor

Contents

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
  • class HDifunctor f where
    • class HFunctor (h :: (* -> *) -> * -> *) where
      • newtype I a = I {}
      • newtype K a i = K {}
      • 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.

      Minimal complete definition

      hdimap

      Methods

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

      Instances
      HDifunctor f => HDifunctor (f :&: p) Source # 
      Instance details

      Defined in Data.Comp.Param.Multi.Ops

      Methods

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

      (HDifunctor f, HDifunctor g) => HDifunctor (f :+: g) Source # 
      Instance details

      Defined in Data.Comp.Param.Multi.Ops

      Methods

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

      class HFunctor (h :: (* -> *) -> * -> *) where #

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

      Minimal complete definition

      hfmap

      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.

      Instance details

      Defined in Data.Comp.Param.Multi.HDifunctor

      Methods

      hfmap :: (f0 :-> g) -> f a f0 :-> f a g #

      Functor f => HFunctor (Compose f :: (* -> *) -> * -> *) 
      Instance details

      Defined in Data.Comp.Multi.HFunctor

      Methods

      hfmap :: (f0 :-> g) -> Compose f f0 :-> Compose f g #

      newtype I a #

      The identity Functor.

      Constructors

      I 

      Fields

      Instances
      Functor I 
      Instance details

      Defined in Data.Comp.Multi.HFunctor

      Methods

      fmap :: (a -> b) -> I a -> I b #

      (<$) :: a -> I b -> I a #

      Foldable I 
      Instance details

      Defined in Data.Comp.Multi.HFunctor

      Methods

      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 #

      toList :: I a -> [a] #

      null :: I a -> Bool #

      length :: I a -> Int #

      elem :: Eq a => a -> I a -> Bool #

      maximum :: Ord a => I a -> a #

      minimum :: Ord a => I a -> a #

      sum :: Num a => I a -> a #

      product :: Num a => I a -> a #

      Traversable I 
      Instance details

      Defined in Data.Comp.Multi.HFunctor

      Methods

      traverse :: Applicative f => (a -> f b) -> I a -> f (I b) #

      sequenceA :: Applicative f => I (f a) -> f (I a) #

      mapM :: Monad m => (a -> m b) -> I a -> m (I b) #

      sequence :: Monad m => I (m a) -> m (I a) #

      newtype K a i #

      The parametrised constant functor.

      Constructors

      K 

      Fields

      Instances
      Functor (K a) 
      Instance details

      Defined in Data.Comp.Multi.HFunctor

      Methods

      fmap :: (a0 -> b) -> K a a0 -> K a b #

      (<$) :: a0 -> K a b -> K a a0 #

      Foldable (K a) 
      Instance details

      Defined in Data.Comp.Multi.HFunctor

      Methods

      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 #

      toList :: K a a0 -> [a0] #

      null :: K a a0 -> Bool #

      length :: K a a0 -> Int #

      elem :: Eq a0 => a0 -> K a a0 -> Bool #

      maximum :: Ord a0 => K a a0 -> a0 #

      minimum :: Ord a0 => K a a0 -> a0 #

      sum :: Num a0 => K a a0 -> a0 #

      product :: Num a0 => K a a0 -> a0 #

      Traversable (K a) 
      Instance details

      Defined in Data.Comp.Multi.HFunctor

      Methods

      traverse :: Applicative f => (a0 -> f b) -> K a a0 -> f (K a b) #

      sequenceA :: Applicative f => K a (f a0) -> f (K a a0) #

      mapM :: Monad m => (a0 -> m b) -> K a a0 -> m (K a b) #

      sequence :: Monad m => K a (m a0) -> m (K a a0) #

      Eq a => PEq (K a) Source # 
      Instance details

      Defined in Data.Comp.Param.Multi.Equality

      Methods

      peq :: K a i -> K a j -> FreshM Bool Source #

      Ord a => POrd (K a) Source # 
      Instance details

      Defined in Data.Comp.Param.Multi.Ordering

      Methods

      pcompare :: K a i -> K a j -> FreshM Ordering Source #

      Eq a => Eq (K a i) 
      Instance details

      Defined in Data.Comp.Multi.HFunctor

      Methods

      (==) :: K a i -> K a i -> Bool #

      (/=) :: K a i -> K a i -> Bool #

      Ord a => Ord (K a i) 
      Instance details

      Defined in Data.Comp.Multi.HFunctor

      Methods

      compare :: K a i -> K a i -> Ordering #

      (<) :: K a i -> K a i -> Bool #

      (<=) :: K a i -> K a i -> Bool #

      (>) :: K a i -> K a i -> Bool #

      (>=) :: K a i -> K a i -> Bool #

      max :: K a i -> K a i -> K a i #

      min :: K a i -> K a i -> K a i #

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

      Constructors

      E :: E f 

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

      Orphan instances

      HDifunctor f => HFunctor (f a) Source #

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

      Instance details

      Methods

      hfmap :: (f0 :-> g) -> f a f0 :-> f a g #