compdata-0.11: Compositional Data Types

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

Data.Comp.Annotation

Description

This module defines annotations on signatures.

Synopsis

Documentation

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

This data type adds a constant product (annotation) to a signature.

Constructors

(f e) :&: a infixr 7 

Instances

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

Methods

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

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

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

Methods

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

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

Methods

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

projectA :: s' a -> (p a, (k :+: (k :&: f) p) s') Source #

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

Methods

remA :: (k :+: f) s' a -> s' a Source #

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

Methods

fmap :: (a -> b) -> (* :&: f) a a -> (* :&: f) a b #

(<$) :: a -> (* :&: f) a b -> (* :&: f) a a #

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

Methods

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

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

foldr :: (a -> b -> b) -> b -> (* :&: f) a a -> b #

foldr' :: (a -> b -> b) -> b -> (* :&: f) a a -> b #

foldl :: (b -> a -> b) -> b -> (* :&: f) a a -> b #

foldl' :: (b -> a -> b) -> b -> (* :&: f) a a -> b #

foldr1 :: (a -> a -> a) -> (* :&: f) a a -> a #

foldl1 :: (a -> a -> a) -> (* :&: f) a a -> a #

toList :: (* :&: f) a a -> [a] #

null :: (* :&: f) a a -> Bool #

length :: (* :&: f) a a -> Int #

elem :: Eq a => a -> (* :&: f) a a -> Bool #

maximum :: Ord a => (* :&: f) a a -> a #

minimum :: Ord a => (* :&: f) a a -> a #

sum :: Num a => (* :&: f) a a -> a #

product :: Num a => (* :&: f) a a -> a #

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

Methods

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

sequenceA :: Applicative f => (* :&: f) a (f a) -> f ((* :&: f) a a) #

mapM :: Monad m => (a -> m b) -> (* :&: f) a a -> m ((* :&: f) a b) #

sequence :: Monad m => (* :&: f) a (m a) -> m ((* :&: f) a a) #

HasVars f v => HasVars ((:&:) * f a) v Source # 

Methods

isVar :: (* :&: f) a a -> Maybe v Source #

bindsVars :: Mapping m a => (* :&: f) a a -> m (Set v) Source #

data (f :*: g) a infixr 8 Source #

Formal product of signatures (functors).

Constructors

(f a) :*: (g a) infixr 8 

Instances

(Functor f, Functor g) => Functor ((:*:) * f g) Source # 

Methods

fmap :: (a -> b) -> (* :*: f) g a -> (* :*: f) g b #

(<$) :: a -> (* :*: f) g b -> (* :*: f) g a #

(Foldable f, Foldable g) => Foldable ((:*:) * f g) Source # 

Methods

fold :: Monoid m => (* :*: f) g m -> m #

foldMap :: Monoid m => (a -> m) -> (* :*: f) g a -> m #

foldr :: (a -> b -> b) -> b -> (* :*: f) g a -> b #

foldr' :: (a -> b -> b) -> b -> (* :*: f) g a -> b #

foldl :: (b -> a -> b) -> b -> (* :*: f) g a -> b #

foldl' :: (b -> a -> b) -> b -> (* :*: f) g a -> b #

foldr1 :: (a -> a -> a) -> (* :*: f) g a -> a #

foldl1 :: (a -> a -> a) -> (* :*: f) g a -> a #

toList :: (* :*: f) g a -> [a] #

null :: (* :*: f) g a -> Bool #

length :: (* :*: f) g a -> Int #

elem :: Eq a => a -> (* :*: f) g a -> Bool #

maximum :: Ord a => (* :*: f) g a -> a #

minimum :: Ord a => (* :*: f) g a -> a #

sum :: Num a => (* :*: f) g a -> a #

product :: Num a => (* :*: f) g a -> a #

(Traversable f, Traversable g) => Traversable ((:*:) * f g) Source # 

Methods

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

sequenceA :: Applicative f => (* :*: f) g (f a) -> f ((* :*: f) g a) #

mapM :: Monad m => (a -> m b) -> (* :*: f) g a -> m ((* :*: f) g b) #

sequence :: Monad m => (* :*: f) g (m a) -> m ((* :*: f) g a) #

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 #

Inject an annotation over a signature.

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

Project an annotation from a signature.

Instances

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

Methods

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

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

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

Methods

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

projectA :: s' a -> (p a, (k :+: (k :&: f) p) s') Source #

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

Minimal complete definition

remA

Methods

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

Remove annotations from a signature.

Instances

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

Methods

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

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

Methods

remA :: (k :+: f) s' a -> s' a Source #

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

Transform 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.

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

Transform 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, Functor g) => CxtFun g f Source #

Strip the annotations from a term over a functor with annotations.

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

Lift a term homomorphism over signatures f and g to a term homomorphism over the same signatures, but extended with annotations.

propAnnM :: (DistAnn f p f', DistAnn g p g', Functor g, Monad m) => HomM m f g -> HomM m f' g' Source #

Lift a monadic term homomorphism over signatures f and g to a monadic term homomorphism over the same signatures, but extended with annotations.

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

Annotate each node of a term with a constant value.

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

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