compdata-0.11: Compositional Data Types

Copyright(c) 2011 Patrick Bahr
LicenseBSD3
MaintainerPatrick Bahr <paba@diku.dk>
Stabilityexperimental
Portabilitynon-portable (GHC Extensions)
Safe HaskellNone
LanguageHaskell98

Data.Comp.Multi.Annotation

Description

This module defines annotations on signatures. All definitions are generalised versions of those in Data.Comp.Annotation.

Synopsis

Documentation

data (f :&: a) g e infixr 7 Source #

This data type adds a constant product to a signature. Alternatively, this could have also been defined as

data (f :&: a) (g ::  * -> *) e = f g e :&: a e

This is too general, however, for example for productHHom.

Constructors

(f g e) :&: a infixr 7 

Instances

DistAnn f p ((:&:) * f p) Source # 

Methods

injectA :: p -> f a :-> (* :&: f) p a Source #

projectA :: (* :&: f) p a i -> (* :&: f a) p i Source #

HFunctor f => HFunctor ((:&:) * f a) Source # 

Methods

hfmap :: (f :-> g) -> (* :&: f) a f :-> (* :&: f) a g Source #

HFoldable f => HFoldable ((:&:) * f a) Source # 

Methods

hfold :: Monoid m => (* :&: f) a (K m) :=> m Source #

hfoldMap :: Monoid m => (a :=> m) -> (* :&: f) a a :=> m Source #

hfoldr :: (a :=> (b -> b)) -> b -> (* :&: f) a a :=> b Source #

hfoldl :: (b -> a :=> b) -> b -> (* :&: f) a a :=> b Source #

hfoldr1 :: (a -> a -> a) -> (* :&: f) a (K a) :=> a Source #

hfoldl1 :: (a -> a -> a) -> (* :&: f) a (K a) :=> a Source #

HTraversable f => HTraversable ((:&:) * f a) Source # 

Methods

hmapM :: Monad m => NatM m a b -> NatM m ((* :&: f) a a) ((* :&: f) a b) Source #

htraverse :: Applicative f => NatM f a b -> NatM f ((* :&: f) a a) ((* :&: f) a b) Source #

RemA ((:&:) * f p) f Source # 

Methods

remA :: (* :&: f) p a i -> f a i Source #

DistAnn s p s' => DistAnn ((:+:) * f s) p ((:+:) * ((:&:) * f p) s') Source # 

Methods

injectA :: p -> (* :+: f) s a :-> (* :+: (* :&: f) p) s' a Source #

projectA :: (* :+: (* :&: f) p) s' a i -> (* :&: (* :+: f) s a) p i Source #

RemA s s' => RemA ((:+:) * ((:&:) * f p) s) ((:+:) * f s') Source # 

Methods

remA :: (* :+: (* :&: f) p) s a i -> (* :+: f) s' a i Source #

class DistAnn s p s' | s' -> s, s' -> p where Source #

This class defines how to distribute an annotation over a sum of signatures.

Minimal complete definition

injectA, projectA

Methods

injectA :: p -> s a :-> s' a Source #

This function injects an annotation over a signature.

projectA :: s' a :-> (s a :&: p) Source #

Instances

DistAnn f p ((:&:) * f p) Source # 

Methods

injectA :: p -> f a :-> (* :&: f) p a Source #

projectA :: (* :&: f) p a i -> (* :&: f a) p i Source #

DistAnn s p s' => DistAnn ((:+:) * f s) p ((:+:) * ((:&:) * f p) s') Source # 

Methods

injectA :: p -> (* :+: f) s a :-> (* :+: (* :&: f) p) s' a Source #

projectA :: (* :+: (* :&: f) p) s' a i -> (* :&: (* :+: f) s a) p i Source #

class RemA s s' | s -> s' where Source #

Minimal complete definition

remA

Methods

remA :: s a :-> s' a Source #

Instances

RemA ((:&:) * f p) f Source # 

Methods

remA :: (* :&: f) p a i -> f a i Source #

RemA s s' => RemA ((:+:) * ((:&:) * f p) s) ((:+:) * f s') Source # 

Methods

remA :: (* :+: (* :&: f) p) s a i -> (* :+: f) s' a i Source #

liftA :: RemA s s' => (s' a :-> t) -> s a :-> t Source #

This function transforms a function with a domain constructed from a functor to a function with a domain constructed with the same functor but with an additional annotation.

ann :: (DistAnn f p g, HFunctor f) => p -> CxtFun f g Source #

This function annotates each sub term of the given term with the given value (of type a).

liftA' :: (DistAnn s' p s, HFunctor s') => (s' a :-> Cxt h s' a) -> s a :-> Cxt h s a Source #

This function transforms a function with a domain constructed from a functor to a function with a domain constructed with the same functor but with an additional annotation.

stripA :: (RemA g f, HFunctor g) => CxtFun g f Source #

This function strips the annotations from a term over a functor with annotations.

propAnn :: (DistAnn f p f', DistAnn g p g', HFunctor g) => Hom f g -> Hom f' g' Source #

project' :: (RemA f f', s :<: f') => Cxt h f a i -> Maybe (s (Cxt h f a) i) Source #

This function is similar to project but applies to signatures with an annotation which is then ignored.