compdata-0.6.1.3: Compositional Data Types

Portabilitynon-portable (GHC Extensions)
Stabilityexperimental
MaintainerTom Hvitved <hvitved@diku.dk>
Safe HaskellNone

Data.Comp.Param.Annotation

Description

This module defines annotations on signatures.

Synopsis

Documentation

data (f :&: p) a b Source

This data type adds a constant product to a signature.

Constructors

(f a b) :&: p 

Instances

DistAnn f p (:&: f p) 
Difunctor f => Difunctor (:&: f p) 
Ditraversable f => Ditraversable (:&: f p) 
(ShowD f, Show p) => ShowD (:&: f p) 
RemA (:&: f p) f 
DistAnn s p s' => DistAnn (:+: f s) p (:+: (:&: f p) s') 
RemA s s' => RemA (:+: (:&: f p) s) (:+: f s') 

data (f :*: g) a b Source

Formal product of signatures (difunctors).

Constructors

(f a b) :*: (g a b) 

class DistAnn s p s' | s' -> s, s' -> p whereSource

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

Methods

injectA :: p -> s a b -> s' a bSource

Inject an annotation over a signature.

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

Project an annotation from a signature.

Instances

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

class RemA s s' | s -> s' whereSource

Methods

remA :: s a b -> s' a bSource

Remove annotations from a signature.

Instances

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

liftA :: RemA s s' => (s' a b -> t) -> s a b -> tSource

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, Difunctor s') => (s' a b -> Cxt h s' c d) -> s a b -> Cxt h s c dSource

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, Difunctor g) => CxtFun g fSource

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

propAnn :: (DistAnn f p f', DistAnn g p g', Difunctor 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', Difunctor 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, Difunctor f) => p -> CxtFun f gSource

Annotate each node of a term with a constant value.

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

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