compdata-dags-0.2.1: Compositional Data Types on DAGs

Copyright (c) 2014 Patrick Bahr Emil Axelsson BSD3 Patrick Bahr experimental non-portable (GHC Extensions) None Haskell98

Data.Comp.Dag.AG

Description

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.

Synopsis

# Documentation

Arguments

 :: Traversable f => (d -> d -> d) resolution function for inherited attributes -> Syn' f (u, d) u semantic function of synthesised attributes -> Inh' f (u, d) d semantic function of inherited attributes -> (u -> d) initialisation of inherited attributes -> Dag f input dag -> u

This function runs an attribute grammar on a dag. The result is the (combined) synthesised attribute at the root of the dag.

Arguments

 :: (Traversable f, Traversable g) => (d -> d -> d) resolution function for inherited attributes -> Syn' f (u, d) u semantic function of synthesised attributes -> Inh' f (u, d) d semantic function of inherited attributes -> Rewrite f (u, d) g initialisation of inherited attributes -> (u -> d) input term -> Dag f -> (u, Dag g)

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.

class (Functor t, Foldable t) => Traversable (t :: * -> *) #

Functors representing data structures that can be traversed from left to right.

A definition of traverse must satisfy the following laws:

naturality
t . traverse f = traverse (t . f) for every applicative transformation t
identity
traverse Identity = Identity
composition
traverse (Compose . fmap g . f) = Compose . fmap (traverse g) . traverse f

A definition of sequenceA must satisfy the following laws:

naturality
t . sequenceA = sequenceA . fmap t for every applicative transformation t
identity
sequenceA . fmap Identity = Identity
composition
sequenceA . fmap Compose = Compose . fmap sequenceA . sequenceA

where an applicative transformation is a function

t :: (Applicative f, Applicative g) => f a -> g a

preserving the Applicative operations, i.e.

• t (pure x) = pure x
• t (x <*> y) = t x <*> t y

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). Minimal complete definition Instances  Since: base-2.1 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> [a] -> f [b] #sequenceA :: Applicative f => [f a] -> f [a] #mapM :: Monad m => (a -> m b) -> [a] -> m [b] #sequence :: Monad m => [m a] -> m [a] # Since: base-2.1 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> Maybe a -> f (Maybe b) #sequenceA :: Applicative f => Maybe (f a) -> f (Maybe a) #mapM :: Monad m => (a -> m b) -> Maybe a -> m (Maybe b) #sequence :: Monad m => Maybe (m a) -> m (Maybe a) # Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> Par1 a -> f (Par1 b) #sequenceA :: Applicative f => Par1 (f a) -> f (Par1 a) #mapM :: Monad m => (a -> m b) -> Par1 a -> m (Par1 b) #sequence :: Monad m => Par1 (m a) -> m (Par1 a) # Since: base-4.9.0.0 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> ZipList a -> f (ZipList b) #sequenceA :: Applicative f => ZipList (f a) -> f (ZipList a) #mapM :: Monad m => (a -> m b) -> ZipList a -> m (ZipList b) #sequence :: Monad m => ZipList (m a) -> m (ZipList a) # Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> Identity a -> f (Identity b) #sequenceA :: Applicative f => Identity (f a) -> f (Identity a) #mapM :: Monad m => (a -> m b) -> Identity a -> m (Identity b) #sequence :: Monad m => Identity (m a) -> m (Identity a) # Since: base-4.8.0.0 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> First a -> f (First b) #sequenceA :: Applicative f => First (f a) -> f (First a) #mapM :: Monad m => (a -> m b) -> First a -> m (First b) #sequence :: Monad m => First (m a) -> m (First a) # Since: base-4.8.0.0 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> Last a -> f (Last b) #sequenceA :: Applicative f => Last (f a) -> f (Last a) #mapM :: Monad m => (a -> m b) -> Last a -> m (Last b) #sequence :: Monad m => Last (m a) -> m (Last a) # Since: base-4.8.0.0 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> Dual a -> f (Dual b) #sequenceA :: Applicative f => Dual (f a) -> f (Dual a) #mapM :: Monad m => (a -> m b) -> Dual a -> m (Dual b) #sequence :: Monad m => Dual (m a) -> m (Dual a) # Since: base-4.8.0.0 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> Sum a -> f (Sum b) #sequenceA :: Applicative f => Sum (f a) -> f (Sum a) #mapM :: Monad m => (a -> m b) -> Sum a -> m (Sum b) #sequence :: Monad m => Sum (m a) -> m (Sum a) # Since: base-4.8.0.0 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> Product a -> f (Product b) #sequenceA :: Applicative f => Product (f a) -> f (Product a) #mapM :: Monad m => (a -> m b) -> Product a -> m (Product b) #sequence :: Monad m => Product (m a) -> m (Product a) # Since: base-4.9.0.0 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> NonEmpty a -> f (NonEmpty b) #sequenceA :: Applicative f => NonEmpty (f a) -> f (NonEmpty a) #mapM :: Monad m => (a -> m b) -> NonEmpty a -> m (NonEmpty b) #sequence :: Monad m => NonEmpty (m a) -> m (NonEmpty a) # Instance detailsDefined in Data.Tree Methodstraverse :: Applicative f => (a -> f b) -> Tree a -> f (Tree b) #sequenceA :: Applicative f => Tree (f a) -> f (Tree a) #mapM :: Monad m => (a -> m b) -> Tree a -> m (Tree b) #sequence :: Monad m => Tree (m a) -> m (Tree a) # Instance detailsDefined in Data.IntMap.Internal Methodstraverse :: Applicative f => (a -> f b) -> IntMap a -> f (IntMap b) #sequenceA :: Applicative f => IntMap (f a) -> f (IntMap a) #mapM :: Monad m => (a -> m b) -> IntMap a -> m (IntMap b) #sequence :: Monad m => IntMap (m a) -> m (IntMap a) # Instance detailsDefined in Data.Sequence.Internal Methodstraverse :: Applicative f => (a -> f b) -> Seq a -> f (Seq b) #sequenceA :: Applicative f => Seq (f a) -> f (Seq a) #mapM :: Monad m => (a -> m b) -> Seq a -> m (Seq b) #sequence :: Monad m => Seq (m a) -> m (Seq a) # Instance detailsDefined in Data.Sequence.Internal Methodstraverse :: Applicative f => (a -> f b) -> FingerTree a -> f (FingerTree b) #sequenceA :: Applicative f => FingerTree (f a) -> f (FingerTree a) #mapM :: Monad m => (a -> m b) -> FingerTree a -> m (FingerTree b) #sequence :: Monad m => FingerTree (m a) -> m (FingerTree a) # Instance detailsDefined in Data.Sequence.Internal Methodstraverse :: Applicative f => (a -> f b) -> Digit a -> f (Digit b) #sequenceA :: Applicative f => Digit (f a) -> f (Digit a) #mapM :: Monad m => (a -> m b) -> Digit a -> m (Digit b) #sequence :: Monad m => Digit (m a) -> m (Digit a) # Instance detailsDefined in Data.Sequence.Internal Methodstraverse :: Applicative f => (a -> f b) -> Node a -> f (Node b) #sequenceA :: Applicative f => Node (f a) -> f (Node a) #mapM :: Monad m => (a -> m b) -> Node a -> m (Node b) #sequence :: Monad m => Node (m a) -> m (Node a) # Instance detailsDefined in Data.Sequence.Internal Methodstraverse :: Applicative f => (a -> f b) -> Elem a -> f (Elem b) #sequenceA :: Applicative f => Elem (f a) -> f (Elem a) #mapM :: Monad m => (a -> m b) -> Elem a -> m (Elem b) #sequence :: Monad m => Elem (m a) -> m (Elem a) # Instance detailsDefined in Data.Sequence.Internal Methodstraverse :: Applicative f => (a -> f b) -> ViewL a -> f (ViewL b) #sequenceA :: Applicative f => ViewL (f a) -> f (ViewL a) #mapM :: Monad m => (a -> m b) -> ViewL a -> m (ViewL b) #sequence :: Monad m => ViewL (m a) -> m (ViewL a) # Instance detailsDefined in Data.Sequence.Internal Methodstraverse :: Applicative f => (a -> f b) -> ViewR a -> f (ViewR b) #sequenceA :: Applicative f => ViewR (f a) -> f (ViewR a) #mapM :: Monad m => (a -> m b) -> ViewR a -> m (ViewR b) #sequence :: Monad m => ViewR (m a) -> m (ViewR a) # Instance detailsDefined in Data.Primitive.Array Methodstraverse :: Applicative f => (a -> f b) -> Array a -> f (Array b) #sequenceA :: Applicative f => Array (f a) -> f (Array a) #mapM :: Monad m => (a -> m b) -> Array a -> m (Array b) #sequence :: Monad m => Array (m a) -> m (Array a) # Instance detailsDefined in Data.Vector Methodstraverse :: Applicative f => (a -> f b) -> Vector a -> f (Vector b) #sequenceA :: Applicative f => Vector (f a) -> f (Vector a) #mapM :: Monad m => (a -> m b) -> Vector a -> m (Vector b) #sequence :: Monad m => Vector (m a) -> m (Vector a) # Since: base-4.7.0.0 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a0 -> f b) -> Either a a0 -> f (Either a b) #sequenceA :: Applicative f => Either a (f a0) -> f (Either a a0) #mapM :: Monad m => (a0 -> m b) -> Either a a0 -> m (Either a b) #sequence :: Monad m => Either a (m a0) -> m (Either a a0) # Traversable (V1 :: * -> *) Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> V1 a -> f (V1 b) #sequenceA :: Applicative f => V1 (f a) -> f (V1 a) #mapM :: Monad m => (a -> m b) -> V1 a -> m (V1 b) #sequence :: Monad m => V1 (m a) -> m (V1 a) # Traversable (U1 :: * -> *) Since: base-4.9.0.0 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> U1 a -> f (U1 b) #sequenceA :: Applicative f => U1 (f a) -> f (U1 a) #mapM :: Monad m => (a -> m b) -> U1 a -> m (U1 b) #sequence :: Monad m => U1 (m a) -> m (U1 a) # Since: base-4.7.0.0 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a0 -> f b) -> (a, a0) -> f (a, b) #sequenceA :: Applicative f => (a, f a0) -> f (a, a0) #mapM :: Monad m => (a0 -> m b) -> (a, a0) -> m (a, b) #sequence :: Monad m => (a, m a0) -> m (a, a0) # Ix i => Traversable (Array i) Since: base-2.1 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> Array i a -> f (Array i b) #sequenceA :: Applicative f => Array i (f a) -> f (Array i a) #mapM :: Monad m => (a -> m b) -> Array i a -> m (Array i b) #sequence :: Monad m => Array i (m a) -> m (Array i a) # Traversable (Proxy :: * -> *) Since: base-4.7.0.0 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> Proxy a -> f (Proxy b) #sequenceA :: Applicative f => Proxy (f a) -> f (Proxy a) #mapM :: Monad m => (a -> m b) -> Proxy a -> m (Proxy b) #sequence :: Monad m => Proxy (m a) -> m (Proxy a) # Instance detailsDefined in Data.Comp.Mapping Methodstraverse :: Applicative f => (a -> f b) -> NumMap k a -> f (NumMap k b) #sequenceA :: Applicative f => NumMap k (f a) -> f (NumMap k a) #mapM :: Monad m => (a -> m b) -> NumMap k a -> m (NumMap k b) #sequence :: Monad m => NumMap k (m a) -> m (NumMap k a) # Instance detailsDefined in Data.Map.Internal Methodstraverse :: Applicative f => (a -> f b) -> Map k a -> f (Map k b) #sequenceA :: Applicative f => Map k (f a) -> f (Map k a) #mapM :: Monad m => (a -> m b) -> Map k a -> m (Map k b) #sequence :: Monad m => Map k (m a) -> m (Map k a) # Traversable f => Traversable (ListT f) Instance detailsDefined in Control.Monad.Trans.List Methodstraverse :: Applicative f0 => (a -> f0 b) -> ListT f a -> f0 (ListT f b) #sequenceA :: Applicative f0 => ListT f (f0 a) -> f0 (ListT f a) #mapM :: Monad m => (a -> m b) -> ListT f a -> m (ListT f b) #sequence :: Monad m => ListT f (m a) -> m (ListT f a) # Traversable f => Traversable (MaybeT f) Instance detailsDefined in Control.Monad.Trans.Maybe Methodstraverse :: Applicative f0 => (a -> f0 b) -> MaybeT f a -> f0 (MaybeT f b) #sequenceA :: Applicative f0 => MaybeT f (f0 a) -> f0 (MaybeT f a) #mapM :: Monad m => (a -> m b) -> MaybeT f a -> m (MaybeT f b) #sequence :: Monad m => MaybeT f (m a) -> m (MaybeT f a) # Instance detailsDefined in Data.HashMap.Base Methodstraverse :: Applicative f => (a -> f b) -> HashMap k a -> f (HashMap k b) #sequenceA :: Applicative f => HashMap k (f a) -> f (HashMap k a) #mapM :: Monad m => (a -> m b) -> HashMap k a -> m (HashMap k b) #sequence :: Monad m => HashMap k (m a) -> m (HashMap k a) # Traversable f => Traversable (Rec1 f) Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f0 => (a -> f0 b) -> Rec1 f a -> f0 (Rec1 f b) #sequenceA :: Applicative f0 => Rec1 f (f0 a) -> f0 (Rec1 f a) #mapM :: Monad m => (a -> m b) -> Rec1 f a -> m (Rec1 f b) #sequence :: Monad m => Rec1 f (m a) -> m (Rec1 f a) # Traversable (URec Char :: * -> *) Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> URec Char a -> f (URec Char b) #sequenceA :: Applicative f => URec Char (f a) -> f (URec Char a) #mapM :: Monad m => (a -> m b) -> URec Char a -> m (URec Char b) #sequence :: Monad m => URec Char (m a) -> m (URec Char a) # Traversable (URec Double :: * -> *) Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> URec Double a -> f (URec Double b) #sequenceA :: Applicative f => URec Double (f a) -> f (URec Double a) #mapM :: Monad m => (a -> m b) -> URec Double a -> m (URec Double b) #sequence :: Monad m => URec Double (m a) -> m (URec Double a) # Traversable (URec Float :: * -> *) Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> URec Float a -> f (URec Float b) #sequenceA :: Applicative f => URec Float (f a) -> f (URec Float a) #mapM :: Monad m => (a -> m b) -> URec Float a -> m (URec Float b) #sequence :: Monad m => URec Float (m a) -> m (URec Float a) # Traversable (URec Int :: * -> *) Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> URec Int a -> f (URec Int b) #sequenceA :: Applicative f => URec Int (f a) -> f (URec Int a) #mapM :: Monad m => (a -> m b) -> URec Int a -> m (URec Int b) #sequence :: Monad m => URec Int (m a) -> m (URec Int a) # Traversable (URec Word :: * -> *) Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> URec Word a -> f (URec Word b) #sequenceA :: Applicative f => URec Word (f a) -> f (URec Word a) #mapM :: Monad m => (a -> m b) -> URec Word a -> m (URec Word b) #sequence :: Monad m => URec Word (m a) -> m (URec Word a) # Traversable (URec (Ptr ()) :: * -> *) Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> URec (Ptr ()) a -> f (URec (Ptr ()) b) #sequenceA :: Applicative f => URec (Ptr ()) (f a) -> f (URec (Ptr ()) a) #mapM :: Monad m => (a -> m b) -> URec (Ptr ()) a -> m (URec (Ptr ()) b) #sequence :: Monad m => URec (Ptr ()) (m a) -> m (URec (Ptr ()) a) # Traversable (Const m :: * -> *) Since: base-4.7.0.0 Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> Const m a -> f (Const m b) #sequenceA :: Applicative f => Const m (f a) -> f (Const m a) #mapM :: Monad m0 => (a -> m0 b) -> Const m a -> m0 (Const m b) #sequence :: Monad m0 => Const m (m0 a) -> m0 (Const m a) # Traversable f => Traversable (Cxt h f) Instance detailsDefined in Data.Comp.Term Methodstraverse :: Applicative f0 => (a -> f0 b) -> Cxt h f a -> f0 (Cxt h f b) #sequenceA :: Applicative f0 => Cxt h f (f0 a) -> f0 (Cxt h f a) #mapM :: Monad m => (a -> m b) -> Cxt h f a -> m (Cxt h f b) #sequence :: Monad m => Cxt h f (m a) -> m (Cxt h f a) # Instance detailsDefined in Control.Monad.Trans.Identity Methodstraverse :: Applicative f0 => (a -> f0 b) -> IdentityT f a -> f0 (IdentityT f b) #sequenceA :: Applicative f0 => IdentityT f (f0 a) -> f0 (IdentityT f a) #mapM :: Monad m => (a -> m b) -> IdentityT f a -> m (IdentityT f b) #sequence :: Monad m => IdentityT f (m a) -> m (IdentityT f a) # Traversable f => Traversable (ErrorT e f) Instance detailsDefined in Control.Monad.Trans.Error Methodstraverse :: Applicative f0 => (a -> f0 b) -> ErrorT e f a -> f0 (ErrorT e f b) #sequenceA :: Applicative f0 => ErrorT e f (f0 a) -> f0 (ErrorT e f a) #mapM :: Monad m => (a -> m b) -> ErrorT e f a -> m (ErrorT e f b) #sequence :: Monad m => ErrorT e f (m a) -> m (ErrorT e f a) # Traversable f => Traversable (ExceptT e f) Instance detailsDefined in Control.Monad.Trans.Except Methodstraverse :: Applicative f0 => (a -> f0 b) -> ExceptT e f a -> f0 (ExceptT e f b) #sequenceA :: Applicative f0 => ExceptT e f (f0 a) -> f0 (ExceptT e f a) #mapM :: Monad m => (a -> m b) -> ExceptT e f a -> m (ExceptT e f b) #sequence :: Monad m => ExceptT e f (m a) -> m (ExceptT e f a) # Traversable f => Traversable (WriterT w f) Instance detailsDefined in Control.Monad.Trans.Writer.Lazy Methodstraverse :: Applicative f0 => (a -> f0 b) -> WriterT w f a -> f0 (WriterT w f b) #sequenceA :: Applicative f0 => WriterT w f (f0 a) -> f0 (WriterT w f a) #mapM :: Monad m => (a -> m b) -> WriterT w f a -> m (WriterT w f b) #sequence :: Monad m => WriterT w f (m a) -> m (WriterT w f a) # Traversable f => Traversable (WriterT w f) Instance detailsDefined in Control.Monad.Trans.Writer.Strict Methodstraverse :: Applicative f0 => (a -> f0 b) -> WriterT w f a -> f0 (WriterT w f b) #sequenceA :: Applicative f0 => WriterT w f (f0 a) -> f0 (WriterT w f a) #mapM :: Monad m => (a -> m b) -> WriterT w f a -> m (WriterT w f b) #sequence :: Monad m => WriterT w f (m a) -> m (WriterT w f a) # Traversable (K1 i c :: * -> *) Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f => (a -> f b) -> K1 i c a -> f (K1 i c b) #sequenceA :: Applicative f => K1 i c (f a) -> f (K1 i c a) #mapM :: Monad m => (a -> m b) -> K1 i c a -> m (K1 i c b) #sequence :: Monad m => K1 i c (m a) -> m (K1 i c a) # (Traversable f, Traversable g) => Traversable (f :+: g) Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f0 => (a -> f0 b) -> (f :+: g) a -> f0 ((f :+: g) b) #sequenceA :: Applicative f0 => (f :+: g) (f0 a) -> f0 ((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) # (Traversable f, Traversable g) => Traversable (f :*: g) Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f0 => (a -> f0 b) -> (f :*: g) a -> f0 ((f :*: g) b) #sequenceA :: Applicative f0 => (f :*: g) (f0 a) -> f0 ((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) # (Traversable f, Traversable g) => Traversable (f :+: g) Instance detailsDefined in Data.Comp.Ops Methodstraverse :: Applicative f0 => (a -> f0 b) -> (f :+: g) a -> f0 ((f :+: g) b) #sequenceA :: Applicative f0 => (f :+: g) (f0 a) -> f0 ((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) # (Traversable f, Traversable g) => Traversable (f :*: g) Instance detailsDefined in Data.Comp.Ops Methodstraverse :: Applicative f0 => (a -> f0 b) -> (f :*: g) a -> f0 ((f :*: g) b) #sequenceA :: Applicative f0 => (f :*: g) (f0 a) -> f0 ((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) # Traversable f => Traversable (f :&: a) Instance detailsDefined in Data.Comp.Ops Methodstraverse :: Applicative f0 => (a0 -> f0 b) -> (f :&: a) a0 -> f0 ((f :&: a) b) #sequenceA :: Applicative f0 => (f :&: a) (f0 a0) -> f0 ((f :&: a) a0) #mapM :: Monad m => (a0 -> m b) -> (f :&: a) a0 -> m ((f :&: a) b) #sequence :: Monad m => (f :&: a) (m a0) -> m ((f :&: a) a0) # Traversable f => Traversable (M1 i c f) Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f0 => (a -> f0 b) -> M1 i c f a -> f0 (M1 i c f b) #sequenceA :: Applicative f0 => M1 i c f (f0 a) -> f0 (M1 i c f a) #mapM :: Monad m => (a -> m b) -> M1 i c f a -> m (M1 i c f b) #sequence :: Monad m => M1 i c f (m a) -> m (M1 i c f a) # (Traversable f, Traversable g) => Traversable (f :.: g) Instance detailsDefined in Data.Traversable Methodstraverse :: Applicative f0 => (a -> f0 b) -> (f :.: g) a -> f0 ((f :.: g) b) #sequenceA :: Applicative f0 => (f :.: g) (f0 a) -> f0 ((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) # pr :: p :< q => q -> p # This function projects the component of type e out or the compound value of type p. type (:<) f g = Proj (ComprEmb (Elem f g)) f g infixl 5 # 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)). lookupNumMap' :: Int -> NumMap t a -> Maybe a # lookupNumMap :: a -> Int -> NumMap t a -> a # prodMap :: Mapping m k => v1 -> v2 -> m v1 -> m v2 -> m (v1, v2) # This function constructs the pointwise product of two maps each with a default value. number :: Traversable f => f a -> f (Numbered a) # This function numbers the components of the given functorial value with consecutive integers starting at 0. data Numbered a # This type is used for numbering components of a functorial value. Constructors  Numbered Int a Instances  Mapping (NumMap k) (Numbered k) Instance detailsDefined in Data.Comp.Mapping Methods(&) :: NumMap k v -> NumMap k v -> NumMap k v #(|->) :: Numbered k -> v -> NumMap k v #empty :: NumMap k v #prodMapWith :: (v1 -> v2 -> v) -> v1 -> v2 -> NumMap k v1 -> NumMap k v2 -> NumMap k v #findWithDefault :: a -> Numbered k -> NumMap k a -> a # class Functor m => Mapping (m :: * -> *) k | m -> k where # Minimal complete definition Methods (&) :: m v -> m v -> m v infixr 0 # left-biased union of two mappings. (|->) :: k -> v -> m v infix 1 # This operator constructs a singleton mapping. empty :: m v # This is the empty mapping. prodMapWith :: (v1 -> v2 -> v) -> v1 -> v2 -> m v1 -> m v2 -> m v # This function constructs the pointwise product of two maps each with a default value. findWithDefault :: a -> k -> m a -> a # Returns the value at the given key or returns the given default when the key is not an element of the map. Instances  Mapping (NumMap k) (Numbered k) Instance detailsDefined in Data.Comp.Mapping Methods(&) :: NumMap k v -> NumMap k v -> NumMap k v #(|->) :: Numbered k -> v -> NumMap k v #empty :: NumMap k v #prodMapWith :: (v1 -> v2 -> v) -> v1 -> v2 -> NumMap k v1 -> NumMap k v2 -> NumMap k v #findWithDefault :: a -> Numbered k -> NumMap k a -> a # data NumMap k v # Instances  Instance detailsDefined in Data.Comp.Mapping Methodsfmap :: (a -> b) -> NumMap k a -> NumMap k b #(<$) :: a -> NumMap k b -> NumMap k a # Instance detailsDefined in Data.Comp.Mapping Methodsfold :: Monoid m => NumMap k m -> m #foldMap :: Monoid m => (a -> m) -> NumMap k a -> m #foldr :: (a -> b -> b) -> b -> NumMap k a -> b #foldr' :: (a -> b -> b) -> b -> NumMap k a -> b #foldl :: (b -> a -> b) -> b -> NumMap k a -> b #foldl' :: (b -> a -> b) -> b -> NumMap k a -> b #foldr1 :: (a -> a -> a) -> NumMap k a -> a #foldl1 :: (a -> a -> a) -> NumMap k a -> a #toList :: NumMap k a -> [a] #null :: NumMap k a -> Bool #length :: NumMap k a -> Int #elem :: Eq a => a -> NumMap k a -> Bool #maximum :: Ord a => NumMap k a -> a #minimum :: Ord a => NumMap k a -> a #sum :: Num a => NumMap k a -> a #product :: Num a => NumMap k a -> a # Instance detailsDefined in Data.Comp.Mapping Methodstraverse :: Applicative f => (a -> f b) -> NumMap k a -> f (NumMap k b) #sequenceA :: Applicative f => NumMap k (f a) -> f (NumMap k a) #mapM :: Monad m => (a -> m b) -> NumMap k a -> m (NumMap k b) #sequence :: Monad m => NumMap k (m a) -> m (NumMap k a) # Mapping (NumMap k) (Numbered k) Instance detailsDefined in Data.Comp.Mapping Methods(&) :: NumMap k v -> NumMap k v -> NumMap k v #(|->) :: Numbered k -> v -> NumMap k v #empty :: NumMap k v #prodMapWith :: (v1 -> v2 -> v) -> v1 -> v2 -> NumMap k v1 -> NumMap k v2 -> NumMap k v #findWithDefault :: a -> Numbered k -> NumMap k a -> a #

type Inh f p q = q :< p => Inh' f p q Source #

The type of semantic functions for inherited attributes.

type Inh' f p q = forall m i. (Mapping m i, ?below :: i -> p, ?above :: p) => f i -> m q Source #

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 Syn f p q = q :< p => Syn' f p q Source #

The type of semantic functions for synthesised attributes.

type Syn' f p q = forall a. (?below :: a -> p, ?above :: p) => f a -> q Source #

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 Rewrite f q g = forall a. (?below :: a -> q, ?above :: q) => f a -> Context g a Source #

A simple rewrite function that may depend on (inherited and/or synthesised) attributes.

below :: (?below :: child -> q, p :< q) => child -> p Source #

This function provides access to attributes of the immediate children of the current node.

above :: (?above :: q, p :< q) => p Source #

prodSyn :: (p :< c, q :< c) => Syn f c p -> Syn f c q -> Syn f c (p, q) Source #

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

Combines the semantic functions for two synthesised 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) Source #

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

Combines the semantic functions for two inherited attributes to form a semantic function for the compound attribute consisting of the two original attributes.