-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Compositional Data Types on DAGs
--
-- This library implements recursion schemes on directed acyclic graphs.
-- The recursion schemes are explained in detail in the paper
-- Generalising Tree Traversals to DAGs
-- (http://dx.doi.org/10.1145/2678015.2682539).
@package compdata-dags
@version 0.2.1
-- | This module implements recursion schemes derived from attribute
-- grammars.
module Data.Comp.AG
-- | This function runs an attribute grammar on a term. The result is the
-- (combined) synthesised attribute at the root of the term.
runAG :: forall f u d. Traversable f => Syn' f (u, d) u -> Inh' f (u, d) d -> (u -> d) -> Term f -> u
-- | This function runs an attribute grammar with rewrite function on a
-- term. The result is the (combined) synthesised attribute at the root
-- of the term and the rewritten term.
runRewrite :: forall f g u d. (Traversable f, Functor g) => Syn' f (u, d) u -> Inh' f (u, d) d -> Rewrite f (u, d) g -> (u -> d) -> Term f -> (u, Term g)
-- | Functors representing data structures that can be traversed from left
-- to right.
--
-- A definition of traverse must satisfy the following laws:
--
--
--
-- A definition of sequenceA must satisfy the following laws:
--
--
--
-- where an applicative transformation is a function
--
--
-- t :: (Applicative f, Applicative g) => f a -> g a
--
--
-- preserving the Applicative operations, i.e.
--
--
--
-- and the identity functor Identity and composition of functors
-- Compose are defined as
--
--
-- newtype Identity a = Identity a
--
-- instance Functor Identity where
-- fmap f (Identity x) = Identity (f x)
--
-- instance Applicative Identity where
-- pure x = Identity x
-- Identity f <*> Identity x = Identity (f x)
--
-- newtype Compose f g a = Compose (f (g a))
--
-- instance (Functor f, Functor g) => Functor (Compose f g) where
-- fmap f (Compose x) = Compose (fmap (fmap f) x)
--
-- instance (Applicative f, Applicative g) => Applicative (Compose f g) where
-- pure x = Compose (pure (pure x))
-- Compose f <*> Compose x = Compose ((<*>) <$> f <*> x)
--
--
-- (The naturality law is implied by parametricity.)
--
-- Instances are similar to Functor, e.g. given a data type
--
--
-- data Tree a = Empty | Leaf a | Node (Tree a) a (Tree a)
--
--
-- a suitable instance would be
--
--
-- instance Traversable Tree where
-- traverse f Empty = pure Empty
-- traverse f (Leaf x) = Leaf <$> f x
-- traverse f (Node l k r) = Node <$> traverse f l <*> f k <*> traverse f r
--
--
-- This is suitable even for abstract types, as the laws for
-- <*> imply a form of associativity.
--
-- The superclass instances should satisfy the following:
--
--
-- - In the Functor instance, fmap should be equivalent
-- to traversal with the identity applicative functor
-- (fmapDefault).
-- - In the Foldable instance, foldMap should be
-- equivalent to traversal with a constant applicative functor
-- (foldMapDefault).
--
class (Functor t, Foldable t) => Traversable (t :: * -> *)
-- | This function projects the component of type e out or the
-- compound value of type p.
pr :: p :< q => q -> p
-- | The constraint e :< p expresses that e is a
-- component of the type p. That is, p is formed by
-- binary products using the type e. The occurrence of
-- e must be unique. For example we have Int :<
-- (Bool,(Int,Bool)) but not Bool :< (Bool,(Int,Bool)).
type (:<) f g = Proj ComprEmb Elem f g f g
lookupNumMap' :: () => Int -> NumMap t a -> Maybe a
lookupNumMap :: () => a -> Int -> NumMap t a -> a
-- | This function constructs the pointwise product of two maps each with a
-- default value.
prodMap :: Mapping m k => v1 -> v2 -> m v1 -> m v2 -> m (v1, v2)
-- | This function numbers the components of the given functorial value
-- with consecutive integers starting at 0.
number :: Traversable f => f a -> f Numbered a
unNumbered :: () => Numbered a -> a
-- | This type is used for numbering components of a functorial value.
data Numbered a
Numbered :: Int -> a -> Numbered a
class Functor m => Mapping (m :: * -> *) k | m -> k
-- | left-biased union of two mappings.
(&) :: Mapping m k => m v -> m v -> m v
-- | This operator constructs a singleton mapping.
(|->) :: Mapping m k => k -> v -> m v
-- | This is the empty mapping.
empty :: Mapping m k => m v
-- | This function constructs the pointwise product of two maps each with a
-- default value.
prodMapWith :: Mapping m k => v1 -> v2 -> v -> v1 -> v2 -> m v1 -> m v2 -> m v
-- | Returns the value at the given key or returns the given default when
-- the key is not an element of the map.
findWithDefault :: Mapping m k => a -> k -> m a -> a
data NumMap k v
-- | The type of semantic functions for inherited attributes.
type Inh f p q = (q :< p) => Inh' f p q
-- | The type of semantic functions for inherited attributes. For defining
-- semantic functions use the type Inh, which includes the
-- inherited attribute that is defined by the semantic function into the
-- available attributes.
type Inh' f p q = forall m i. (Mapping m i, ?below :: i -> p, ?above :: p) => f i -> m q
-- | The type of semantic functions for synthesised attributes.
type Syn f p q = (q :< p) => Syn' f p q
-- | The type of semantic functions for synthesised attributes. For
-- defining semantic functions use the type Syn, which includes
-- the synthesised attribute that is defined by the semantic function
-- into the available attributes.
type Syn' f p q = forall a. (?below :: a -> p, ?above :: p) => f a -> q
-- | A simple rewrite function that may depend on (inherited and/or
-- synthesised) attributes.
type Rewrite f q g = forall a. (?below :: a -> q, ?above :: q) => f a -> Context g a
-- | This function provides access to attributes of the immediate children
-- of the current node.
below :: (?below :: child -> q, p :< q) => child -> p
-- | This function provides access to attributes of the current node
above :: (?above :: q, p :< q) => p
-- | Combines the semantic functions for two synthesised attributes to form
-- a semantic function for the compound attribute consisting of the two
-- original attributes.
prodSyn :: (p :< c, q :< c) => Syn f c p -> Syn f c q -> Syn f c (p, q)
-- | Combines the semantic functions for two synthesised attributes to form
-- a semantic function for the compound attribute consisting of the two
-- original attributes.
(|*|) :: (p :< c, q :< c) => Syn f c p -> Syn f c q -> Syn f c (p, q)
-- | Combines the semantic functions for two inherited attributes to form a
-- semantic function for the compound attribute consisting of the two
-- original attributes.
prodInh :: (p :< c, q :< c) => Inh f c p -> Inh f c q -> Inh f c (p, q)
-- | Combines the semantic functions for two inherited attributes to form a
-- semantic function for the compound attribute consisting of the two
-- original attributes.
(>*<) :: (p :< c, q :< c, Functor f) => Inh f c p -> Inh f c q -> Inh f c (p, q)
-- | This module implements a representation of directed acyclic graphs
-- (DAGs) as compact representations of trees (or Terms).
module Data.Comp.Dag
-- | The type of directed acyclic graphs (DAGs). Dags are used as a
-- compact representation of Terms.
data Dag f
-- | Turn a term into a graph without sharing.
termTree :: Functor f => Term f -> Dag f
-- | This function takes a term, and returns a Dag with the implicit
-- sharing of the input data structure made explicit. If the sharing
-- structure of the term is cyclic an exception of type
-- CyclicException is thrown.
reifyDag :: Traversable f => Term f -> IO (Dag f)
-- | This function unravels a given graph to the term it represents.
unravel :: forall f. Functor f => Dag f -> Term f
-- | Checks whether two dags are bisimilar. In particular, we have the
-- following equality
--
--
-- bisim g1 g2 = (unravel g1 == unravel g2)
--
--
-- That is, two dags are bisimilar iff they have the same unravelling.
bisim :: forall f. (EqF f, Functor f, Foldable f) => Dag f -> Dag f -> Bool
-- | Checks whether the two given DAGs are isomorphic.
iso :: (Traversable f, Foldable f, EqF f) => Dag f -> Dag f -> Bool
-- | Checks whether the two given DAGs are strongly isomorphic, i.e. their
-- internal representation is the same modulo renaming of nodes.
strongIso :: (Functor f, Foldable f, EqF f) => Dag f -> Dag f -> Bool
instance GHC.Show.Show Data.Comp.Dag.CyclicException
instance GHC.Exception.Exception Data.Comp.Dag.CyclicException
instance (Data.Comp.Derive.Show.ShowF f, GHC.Base.Functor f) => GHC.Show.Show (Data.Comp.Dag.Internal.Dag f)
-- | This module implements the recursion schemes from module
-- Data.Comp.AG on Dags. In order to deal with the sharing
-- present in Dags, the recursion schemes additionally take an
-- argument of type d -> d -> d that resolves clashing
-- inherited attribute values.
module Data.Comp.Dag.AG
-- | This function runs an attribute grammar on a dag. The result is the
-- (combined) synthesised attribute at the root of the dag.
runAG :: forall f d u. Traversable f => (d -> d -> d) -> Syn' f (u, d) u -> Inh' f (u, d) d -> (u -> d) -> Dag f -> u
-- | This function runs an attribute grammar with rewrite function on a
-- dag. The result is the (combined) synthesised attribute at the root of
-- the dag and the rewritten dag.
runRewrite :: forall f g d u. (Traversable f, Traversable g) => (d -> d -> d) -> Syn' f (u, d) u -> Inh' f (u, d) d -> Rewrite f (u, d) g -> (u -> d) -> Dag f -> (u, Dag g)
-- | Functors representing data structures that can be traversed from left
-- to right.
--
-- A definition of traverse must satisfy the following laws:
--
--
--
-- A definition of sequenceA must satisfy the following laws:
--
--
--
-- where an applicative transformation is a function
--
--
-- t :: (Applicative f, Applicative g) => f a -> g a
--
--
-- preserving the Applicative operations, i.e.
--
--
--
-- and the identity functor Identity and composition of functors
-- Compose are defined as
--
--
-- newtype Identity a = Identity a
--
-- instance Functor Identity where
-- fmap f (Identity x) = Identity (f x)
--
-- instance Applicative Identity where
-- pure x = Identity x
-- Identity f <*> Identity x = Identity (f x)
--
-- newtype Compose f g a = Compose (f (g a))
--
-- instance (Functor f, Functor g) => Functor (Compose f g) where
-- fmap f (Compose x) = Compose (fmap (fmap f) x)
--
-- instance (Applicative f, Applicative g) => Applicative (Compose f g) where
-- pure x = Compose (pure (pure x))
-- Compose f <*> Compose x = Compose ((<*>) <$> f <*> x)
--
--
-- (The naturality law is implied by parametricity.)
--
-- Instances are similar to Functor, e.g. given a data type
--
--
-- data Tree a = Empty | Leaf a | Node (Tree a) a (Tree a)
--
--
-- a suitable instance would be
--
--
-- instance Traversable Tree where
-- traverse f Empty = pure Empty
-- traverse f (Leaf x) = Leaf <$> f x
-- traverse f (Node l k r) = Node <$> traverse f l <*> f k <*> traverse f r
--
--
-- This is suitable even for abstract types, as the laws for
-- <*> imply a form of associativity.
--
-- The superclass instances should satisfy the following:
--
--
-- - In the Functor instance, fmap should be equivalent
-- to traversal with the identity applicative functor
-- (fmapDefault).
-- - In the Foldable instance, foldMap should be
-- equivalent to traversal with a constant applicative functor
-- (foldMapDefault).
--
class (Functor t, Foldable t) => Traversable (t :: * -> *)
-- | This function projects the component of type e out or the
-- compound value of type p.
pr :: p :< q => q -> p
-- | The constraint e :< p expresses that e is a
-- component of the type p. That is, p is formed by
-- binary products using the type e. The occurrence of
-- e must be unique. For example we have Int :<
-- (Bool,(Int,Bool)) but not Bool :< (Bool,(Int,Bool)).
type (:<) f g = Proj ComprEmb Elem f g f g
lookupNumMap' :: () => Int -> NumMap t a -> Maybe a
lookupNumMap :: () => a -> Int -> NumMap t a -> a
-- | This function constructs the pointwise product of two maps each with a
-- default value.
prodMap :: Mapping m k => v1 -> v2 -> m v1 -> m v2 -> m (v1, v2)
-- | This function numbers the components of the given functorial value
-- with consecutive integers starting at 0.
number :: Traversable f => f a -> f Numbered a
unNumbered :: () => Numbered a -> a
-- | This type is used for numbering components of a functorial value.
data Numbered a
Numbered :: Int -> a -> Numbered a
class Functor m => Mapping (m :: * -> *) k | m -> k
-- | left-biased union of two mappings.
(&) :: Mapping m k => m v -> m v -> m v
-- | This operator constructs a singleton mapping.
(|->) :: Mapping m k => k -> v -> m v
-- | This is the empty mapping.
empty :: Mapping m k => m v
-- | This function constructs the pointwise product of two maps each with a
-- default value.
prodMapWith :: Mapping m k => v1 -> v2 -> v -> v1 -> v2 -> m v1 -> m v2 -> m v
-- | Returns the value at the given key or returns the given default when
-- the key is not an element of the map.
findWithDefault :: Mapping m k => a -> k -> m a -> a
data NumMap k v
-- | The type of semantic functions for inherited attributes.
type Inh f p q = (q :< p) => Inh' f p q
-- | The type of semantic functions for inherited attributes. For defining
-- semantic functions use the type Inh, which includes the
-- inherited attribute that is defined by the semantic function into the
-- available attributes.
type Inh' f p q = forall m i. (Mapping m i, ?below :: i -> p, ?above :: p) => f i -> m q
-- | The type of semantic functions for synthesised attributes.
type Syn f p q = (q :< p) => Syn' f p q
-- | The type of semantic functions for synthesised attributes. For
-- defining semantic functions use the type Syn, which includes
-- the synthesised attribute that is defined by the semantic function
-- into the available attributes.
type Syn' f p q = forall a. (?below :: a -> p, ?above :: p) => f a -> q
-- | A simple rewrite function that may depend on (inherited and/or
-- synthesised) attributes.
type Rewrite f q g = forall a. (?below :: a -> q, ?above :: q) => f a -> Context g a
-- | This function provides access to attributes of the immediate children
-- of the current node.
below :: (?below :: child -> q, p :< q) => child -> p
-- | This function provides access to attributes of the current node
above :: (?above :: q, p :< q) => p
-- | Combines the semantic functions for two synthesised attributes to form
-- a semantic function for the compound attribute consisting of the two
-- original attributes.
prodSyn :: (p :< c, q :< c) => Syn f c p -> Syn f c q -> Syn f c (p, q)
-- | Combines the semantic functions for two synthesised attributes to form
-- a semantic function for the compound attribute consisting of the two
-- original attributes.
(|*|) :: (p :< c, q :< c) => Syn f c p -> Syn f c q -> Syn f c (p, q)
-- | Combines the semantic functions for two inherited attributes to form a
-- semantic function for the compound attribute consisting of the two
-- original attributes.
prodInh :: (p :< c, q :< c) => Inh f c p -> Inh f c q -> Inh f c (p, q)
-- | Combines the semantic functions for two inherited attributes to form a
-- semantic function for the compound attribute consisting of the two
-- original attributes.
(>*<) :: (p :< c, q :< c, Functor f) => Inh f c p -> Inh f c q -> Inh f c (p, q)
-- | This module implements recursion schemes derived from attribute
-- grammars. The variant implemented in this module, called parametric
-- attribute grammars, generalises both attribute grammars and attribute
-- grammars with rewrite function (as implemented in
-- Data.Comp.AG).
module Data.Comp.PAG
-- | This function runs a parametric attribute grammar on a term. The
-- result is the (combined) synthesised attribute at the root of the
-- term.
runPAG :: forall f u d g. (Traversable f, Functor g, Functor d, Functor u) => Syn' f (u :*: d) u g -> Inh' f (u :*: d) d g -> (forall a. u a -> d (Context g a)) -> Term f -> u (Term g)
-- | Functors representing data structures that can be traversed from left
-- to right.
--
-- A definition of traverse must satisfy the following laws:
--
--
--
-- A definition of sequenceA must satisfy the following laws:
--
--
--
-- where an applicative transformation is a function
--
--
-- t :: (Applicative f, Applicative g) => f a -> g a
--
--
-- preserving the Applicative operations, i.e.
--
--
--
-- and the identity functor Identity and composition of functors
-- Compose are defined as
--
--
-- newtype Identity a = Identity a
--
-- instance Functor Identity where
-- fmap f (Identity x) = Identity (f x)
--
-- instance Applicative Identity where
-- pure x = Identity x
-- Identity f <*> Identity x = Identity (f x)
--
-- newtype Compose f g a = Compose (f (g a))
--
-- instance (Functor f, Functor g) => Functor (Compose f g) where
-- fmap f (Compose x) = Compose (fmap (fmap f) x)
--
-- instance (Applicative f, Applicative g) => Applicative (Compose f g) where
-- pure x = Compose (pure (pure x))
-- Compose f <*> Compose x = Compose ((<*>) <$> f <*> x)
--
--
-- (The naturality law is implied by parametricity.)
--
-- Instances are similar to Functor, e.g. given a data type
--
--
-- data Tree a = Empty | Leaf a | Node (Tree a) a (Tree a)
--
--
-- a suitable instance would be
--
--
-- instance Traversable Tree where
-- traverse f Empty = pure Empty
-- traverse f (Leaf x) = Leaf <$> f x
-- traverse f (Node l k r) = Node <$> traverse f l <*> f k <*> traverse f r
--
--
-- This is suitable even for abstract types, as the laws for
-- <*> imply a form of associativity.
--
-- The superclass instances should satisfy the following:
--
--
-- - In the Functor instance, fmap should be equivalent
-- to traversal with the identity applicative functor
-- (fmapDefault).
-- - In the Foldable instance, foldMap should be
-- equivalent to traversal with a constant applicative functor
-- (foldMapDefault).
--
class (Functor t, Foldable t) => Traversable (t :: * -> *)
-- | This function projects the component of type e out or the
-- compound value of type p.
pr :: p :< q => q a -> p a
-- | The constraint e :< p expresses that e is a
-- component of the type p. That is, p is formed by
-- binary products using the type e. The occurrence of
-- e must be unique. For example we have Int :<
-- (Bool,(Int,Bool)) but not Bool :< (Bool,(Int,Bool)).
type (:<) (f :: * -> *) (g :: * -> *) = Proj ComprEmb Elem f g f g
fsnd :: () => f :*: g a -> g a
ffst :: () => f :*: g a -> f a
-- | Formal product of signatures (functors).
data (:*:) (f :: k -> *) (g :: k -> *) (a :: k) :: forall k. () => k -> * -> k -> * -> k -> *
(:*:) :: f a -> g a -> (:*:)
lookupNumMap' :: () => Int -> NumMap t a -> Maybe a
lookupNumMap :: () => a -> Int -> NumMap t a -> a
-- | This function constructs the pointwise product of two maps each with a
-- default value.
prodMap :: Mapping m k => v1 -> v2 -> m v1 -> m v2 -> m (v1, v2)
-- | This function numbers the components of the given functorial value
-- with consecutive integers starting at 0.
number :: Traversable f => f a -> f Numbered a
unNumbered :: () => Numbered a -> a
-- | This type is used for numbering components of a functorial value.
data Numbered a
Numbered :: Int -> a -> Numbered a
class Functor m => Mapping (m :: * -> *) k | m -> k
-- | left-biased union of two mappings.
(&) :: Mapping m k => m v -> m v -> m v
-- | This operator constructs a singleton mapping.
(|->) :: Mapping m k => k -> v -> m v
-- | This is the empty mapping.
empty :: Mapping m k => m v
-- | This function constructs the pointwise product of two maps each with a
-- default value.
prodMapWith :: Mapping m k => v1 -> v2 -> v -> v1 -> v2 -> m v1 -> m v2 -> m v
-- | Returns the value at the given key or returns the given default when
-- the key is not an element of the map.
findWithDefault :: Mapping m k => a -> k -> m a -> a
data NumMap k v
-- | The type of semantic functions for inherited attributes.
type Inh f p q g = (q :< p) => Inh' f p q g
-- | The type of semantic functions for inherited attributes. For defining
-- semantic functions use the type Inh, which includes the
-- inherited attribute that is defined by the semantic function into the
-- available attributes.
type Inh' f p q g = forall m i a. (Mapping m i, ?below :: i -> p a, ?above :: p a) => f i -> m (q (Context g a))
-- | The type of semantic functions for synthesised attributes.
type Syn f p q g = (q :< p) => Syn' f p q g
-- | The type of semantic functions for synthesised attributes. For
-- defining semantic functions use the type Syn, which includes
-- the synthesised attribute that is defined by the semantic function
-- into the available attributes.
type Syn' f p q g = forall child a. (?below :: child -> p a, ?above :: p a) => f child -> q (Context g a)
-- | This function provides access to attributes of the immediate children
-- of the current node.
below :: (?below :: child -> q a, p :< q) => child -> p a
-- | This function provides access to attributes of the current node
above :: (?above :: q a, p :< q) => p a
-- | Combines the semantic functions for two synthesised attributes to form
-- a semantic function for the compound attribute consisting of the two
-- original attributes.
prodSyn :: (p :< c, q :< c) => Syn f c p g -> Syn f c q g -> Syn f c (p :*: q) g
-- | Combines the semantic functions for two synthesised attributes to form
-- a semantic function for the compound attribute consisting of the two
-- original attributes.
(|*|) :: (p :< c, q :< c) => Syn f c p g -> Syn f c q g -> Syn f c (p :*: q) g
-- | Combines the semantic functions for two inherited attributes to form a
-- semantic function for the compound attribute consisting of the two
-- original attributes.
prodInh :: (p :< c, q :< c, Functor p, Functor q) => Inh f c p g -> Inh f c q g -> Inh f c (p :*: q) g
-- | Combines the semantic functions for two inherited attributes to form a
-- semantic function for the compound attribute consisting of the two
-- original attributes.
(>*<) :: (p :< c, q :< c, Functor p, Functor q) => Inh f c p g -> Inh f c q g -> Inh f c (p :*: q) g
-- | This module implements the recursion schemes from module
-- Data.Comp.PAG on Dags. In order to deal with the sharing
-- present in Dags, the recursion schemes additionally take an
-- argument of type d -> d -> d that resolves clashing
-- inherited attribute values.
module Data.Comp.Dag.PAG
-- | This function runs an attribute grammar on a dag. The result is the
-- (combined) synthesised attribute at the root of the dag.
runPAG :: forall f d u g. (Traversable f, Traversable d, Traversable g, Traversable u) => (forall a. d a -> d a -> d a) -> Syn' f (u :*: d) u g -> Inh' f (u :*: d) d g -> (forall a. u a -> d (Context g a)) -> Dag f -> u (Dag g)
-- | Functors representing data structures that can be traversed from left
-- to right.
--
-- A definition of traverse must satisfy the following laws:
--
--
--
-- A definition of sequenceA must satisfy the following laws:
--
--
--
-- where an applicative transformation is a function
--
--
-- t :: (Applicative f, Applicative g) => f a -> g a
--
--
-- preserving the Applicative operations, i.e.
--
--
--
-- and the identity functor Identity and composition of functors
-- Compose are defined as
--
--
-- newtype Identity a = Identity a
--
-- instance Functor Identity where
-- fmap f (Identity x) = Identity (f x)
--
-- instance Applicative Identity where
-- pure x = Identity x
-- Identity f <*> Identity x = Identity (f x)
--
-- newtype Compose f g a = Compose (f (g a))
--
-- instance (Functor f, Functor g) => Functor (Compose f g) where
-- fmap f (Compose x) = Compose (fmap (fmap f) x)
--
-- instance (Applicative f, Applicative g) => Applicative (Compose f g) where
-- pure x = Compose (pure (pure x))
-- Compose f <*> Compose x = Compose ((<*>) <$> f <*> x)
--
--
-- (The naturality law is implied by parametricity.)
--
-- Instances are similar to Functor, e.g. given a data type
--
--
-- data Tree a = Empty | Leaf a | Node (Tree a) a (Tree a)
--
--
-- a suitable instance would be
--
--
-- instance Traversable Tree where
-- traverse f Empty = pure Empty
-- traverse f (Leaf x) = Leaf <$> f x
-- traverse f (Node l k r) = Node <$> traverse f l <*> f k <*> traverse f r
--
--
-- This is suitable even for abstract types, as the laws for
-- <*> imply a form of associativity.
--
-- The superclass instances should satisfy the following:
--
--
-- - In the Functor instance, fmap should be equivalent
-- to traversal with the identity applicative functor
-- (fmapDefault).
-- - In the Foldable instance, foldMap should be
-- equivalent to traversal with a constant applicative functor
-- (foldMapDefault).
--
class (Functor t, Foldable t) => Traversable (t :: * -> *)
-- | This function projects the component of type e out or the
-- compound value of type p.
pr :: p :< q => q a -> p a
-- | The constraint e :< p expresses that e is a
-- component of the type p. That is, p is formed by
-- binary products using the type e. The occurrence of
-- e must be unique. For example we have Int :<
-- (Bool,(Int,Bool)) but not Bool :< (Bool,(Int,Bool)).
type (:<) (f :: * -> *) (g :: * -> *) = Proj ComprEmb Elem f g f g
fsnd :: () => f :*: g a -> g a
ffst :: () => f :*: g a -> f a
-- | Formal product of signatures (functors).
data (:*:) (f :: k -> *) (g :: k -> *) (a :: k) :: forall k. () => k -> * -> k -> * -> k -> *
(:*:) :: f a -> g a -> (:*:)
lookupNumMap' :: () => Int -> NumMap t a -> Maybe a
lookupNumMap :: () => a -> Int -> NumMap t a -> a
-- | This function constructs the pointwise product of two maps each with a
-- default value.
prodMap :: Mapping m k => v1 -> v2 -> m v1 -> m v2 -> m (v1, v2)
-- | This function numbers the components of the given functorial value
-- with consecutive integers starting at 0.
number :: Traversable f => f a -> f Numbered a
unNumbered :: () => Numbered a -> a
-- | This type is used for numbering components of a functorial value.
data Numbered a
Numbered :: Int -> a -> Numbered a
class Functor m => Mapping (m :: * -> *) k | m -> k
-- | left-biased union of two mappings.
(&) :: Mapping m k => m v -> m v -> m v
-- | This operator constructs a singleton mapping.
(|->) :: Mapping m k => k -> v -> m v
-- | This is the empty mapping.
empty :: Mapping m k => m v
-- | This function constructs the pointwise product of two maps each with a
-- default value.
prodMapWith :: Mapping m k => v1 -> v2 -> v -> v1 -> v2 -> m v1 -> m v2 -> m v
-- | Returns the value at the given key or returns the given default when
-- the key is not an element of the map.
findWithDefault :: Mapping m k => a -> k -> m a -> a
data NumMap k v
-- | The type of semantic functions for inherited attributes.
type Inh f p q g = (q :< p) => Inh' f p q g
-- | The type of semantic functions for inherited attributes. For defining
-- semantic functions use the type Inh, which includes the
-- inherited attribute that is defined by the semantic function into the
-- available attributes.
type Inh' f p q g = forall m i a. (Mapping m i, ?below :: i -> p a, ?above :: p a) => f i -> m (q (Context g a))
-- | The type of semantic functions for synthesised attributes.
type Syn f p q g = (q :< p) => Syn' f p q g
-- | The type of semantic functions for synthesised attributes. For
-- defining semantic functions use the type Syn, which includes
-- the synthesised attribute that is defined by the semantic function
-- into the available attributes.
type Syn' f p q g = forall child a. (?below :: child -> p a, ?above :: p a) => f child -> q (Context g a)
-- | This function provides access to attributes of the immediate children
-- of the current node.
below :: (?below :: child -> q a, p :< q) => child -> p a
-- | This function provides access to attributes of the current node
above :: (?above :: q a, p :< q) => p a
-- | Combines the semantic functions for two synthesised attributes to form
-- a semantic function for the compound attribute consisting of the two
-- original attributes.
prodSyn :: (p :< c, q :< c) => Syn f c p g -> Syn f c q g -> Syn f c (p :*: q) g
-- | Combines the semantic functions for two synthesised attributes to form
-- a semantic function for the compound attribute consisting of the two
-- original attributes.
(|*|) :: (p :< c, q :< c) => Syn f c p g -> Syn f c q g -> Syn f c (p :*: q) g
-- | Combines the semantic functions for two inherited attributes to form a
-- semantic function for the compound attribute consisting of the two
-- original attributes.
prodInh :: (p :< c, q :< c, Functor p, Functor q) => Inh f c p g -> Inh f c q g -> Inh f c (p :*: q) g
-- | Combines the semantic functions for two inherited attributes to form a
-- semantic function for the compound attribute consisting of the two
-- original attributes.
(>*<) :: (p :< c, q :< c, Functor p, Functor q) => Inh f c p g -> Inh f c q g -> Inh f c (p :*: q) g