-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Deep natural and unnatural tree transformations, including attribute grammars -- -- This library builds on the rank2classes package to provide the -- equivalents of Functor and related classes for heterogenous -- trees, including complex abstract syntax trees of real-world -- programming languages. -- -- The functionality includes attribute grammars in -- Transformation.AG. @package deep-transformations @version 0.2.3 -- | A natural transformation is a concept from category theory for -- a mapping between two functors and their objects that preserves a -- naturality condition. In Haskell the naturality condition boils down -- to parametricity, so a natural transformation between two functors -- f and g is represented as -- --
--   type NaturalTransformation f g = ∀a. f a → g a
--   
-- -- This type appears in several Haskell libraries, most obviously in -- natural-transformations. There are times, however, when we -- crave more control. Sometimes what we want to do depends on which type -- a is hiding in that f a we're given. Sometimes, in -- other words, we need an unnatural transformation. -- -- This means we have to abandon parametricity for ad-hoc polymorphism, -- and that means type classes. There are two steps to defining a -- transformation: -- -- -- -- The module is meant to be imported qualified. module Transformation -- | A Transformation, natural or not, maps one functor to another. class Transformation t where { type Domain t :: Type -> Type; type Codomain t :: Type -> Type; } -- | An unnatural Transformation can behave differently at different -- points. class Transformation t => At t x -- | Apply the transformation t at type x to map -- Domain to the Codomain functor. ($) :: At t x => t -> Domain t x -> Codomain t x infixr 0 $ -- | Alphabetical synonym for $ apply :: t `At` x => t -> Domain t x -> Codomain t x -- | Composition of two transformations data Compose t u Compose :: t -> u -> Compose t u -- | Transformation under a Functor newtype Mapped (f :: Type -> Type) t Mapped :: t -> Mapped (f :: Type -> Type) t -- | Transformation under a Foldable newtype Folded (f :: Type -> Type) t Folded :: t -> Folded (f :: Type -> Type) t -- | Transformation under a Traversable newtype Traversed (f :: Type -> Type) t Traversed :: t -> Traversed (f :: Type -> Type) t type family ComposeOuter (c :: Type -> Type) :: Type -> Type type family ComposeInner (c :: Type -> Type) :: Type -> Type instance (Transformation.Transformation t, Transformation.Codomain t GHC.Types.~ Data.Functor.Compose.Compose m n) => Transformation.Transformation (Transformation.Traversed f t) instance (Transformation.At t x, Data.Traversable.Traversable f, Transformation.Codomain t GHC.Types.~ Data.Functor.Compose.Compose m n, GHC.Base.Applicative m) => Transformation.At (Transformation.Traversed f t) x instance Transformation.Transformation t => Transformation.Transformation (Transformation.Folded f t) instance (Transformation.At t x, Data.Foldable.Foldable f, Transformation.Codomain t GHC.Types.~ Data.Functor.Const.Const m, GHC.Base.Monoid m) => Transformation.At (Transformation.Folded f t) x instance Transformation.Transformation t => Transformation.Transformation (Transformation.Mapped f t) instance (Transformation.At t x, GHC.Base.Functor f) => Transformation.At (Transformation.Mapped f t) x instance (Transformation.Transformation t, Transformation.Transformation u, Transformation.Domain t GHC.Types.~ Transformation.Codomain u) => Transformation.Transformation (Transformation.Compose t u) instance (Transformation.At t x, Transformation.At u x, Transformation.Domain t GHC.Types.~ Transformation.Codomain u) => Transformation.At (Transformation.Compose t u) x instance Transformation.At (Rank2.Arrow p q x) x instance (Transformation.At t x, Transformation.At u x, Transformation.Domain t GHC.Types.~ Transformation.Domain u) => Transformation.At (t, u) x instance (Transformation.At t x, Transformation.At u x, Transformation.Domain t GHC.Types.~ Transformation.Domain u) => Transformation.At (Data.Either.Either t u) x instance Transformation.Transformation (Rank2.Arrow p q x) instance (Transformation.Transformation t1, Transformation.Transformation t2, Transformation.Domain t1 GHC.Types.~ Transformation.Domain t2) => Transformation.Transformation (t1, t2) instance (Transformation.Transformation t1, Transformation.Transformation t2, Transformation.Domain t1 GHC.Types.~ Transformation.Domain t2) => Transformation.Transformation (Data.Either.Either t1 t2) -- | An attribute grammar is a particular kind of Transformation -- that assigns attributes to nodes in a tree. Different node types may -- have different types of attributes, so the transformation is not -- natural. All attributes are divided into Inherited and -- Synthesized attributes. module Transformation.AG -- | Type family that maps a node type to the type of its attributes, -- indexed per type constructor. type family Atts (f :: Type -> Type) a -- | Type constructor wrapping the inherited attributes for the given -- transformation. newtype Inherited t a Inherited :: Atts (Inherited t) a -> Inherited t a [inh] :: Inherited t a -> Atts (Inherited t) a -- | Type constructor wrapping the synthesized attributes for the given -- transformation. newtype Synthesized t a Synthesized :: Atts (Synthesized t) a -> Synthesized t a [syn] :: Synthesized t a -> Atts (Synthesized t) a -- | A node's Semantics is a natural tranformation from the node's -- inherited attributes to its synthesized attributes. type Semantics t = Inherited t ~> Synthesized t -- | A node's PreservingSemantics is a natural tranformation from -- the node's inherited attributes to all its attributes paired with the -- preserved node. type PreservingSemantics t f = Arrow (Inherited t) (Product (AllAtts t) f) -- | All inherited and synthesized attributes data AllAtts t a AllAtts :: Atts (Inherited t) a -> Atts (Synthesized t) a -> AllAtts t a [allInh] :: AllAtts t a -> Atts (Inherited t) a [allSyn] :: AllAtts t a -> Atts (Synthesized t) a -- | An attribution rule maps a node's inherited attributes and its child -- nodes' synthesized attributes to the node's synthesized attributes and -- the children nodes' inherited attributes. type Rule t g = forall sem. sem ~ Semantics t => (Inherited t (g sem (Semantics t)), g sem (Synthesized t)) -> (Synthesized t (g sem (Semantics t)), g sem (Inherited t)) -- | The core function to tie the recursive knot, turning a Rule for -- a node into its Semantics. knit :: (Apply (g sem), sem ~ Semantics t) => Rule t g -> g sem sem -> sem (g sem sem) -- | Another way to tie the recursive knot, using a Rule to add -- AllAtts information to every node knitKeeping :: forall t f g sem. (sem ~ PreservingSemantics t f, Apply (g sem), Atts (Inherited t) (g sem sem) ~ Atts (Inherited t) (g (Semantics t) (Semantics t)), Atts (Synthesized t) (g sem sem) ~ Atts (Synthesized t) (g (Semantics t) (Semantics t)), g sem (Synthesized t) ~ g (Semantics t) (Synthesized t), g sem (Inherited t) ~ g (Semantics t) (Inherited t)) => (forall a. f a -> a) -> Rule t g -> f (g (PreservingSemantics t f) (PreservingSemantics t f)) -> PreservingSemantics t f (g (PreservingSemantics t f) (PreservingSemantics t f)) -- | The core type class for defining the attribute grammar. The instances -- of this class typically have a form like -- --
--   instance Attribution MyAttGrammar MyNode (Semantics MyAttGrammar) Identity where
--     attribution MyAttGrammar{} (Identity MyNode{})
--                 (Inherited   fromParent,
--                  Synthesized MyNode{firstChild= fromFirstChild, ...})
--               = (Synthesized _forMyself,
--                  Inherited   MyNode{firstChild= _forFirstChild, ...})
--   
-- -- If you prefer to separate the calculation of different attributes, you -- can split the above instance into two instances of the -- Bequether and Synthesizer classes instead. If you derive -- Generic instances for your attributes, you can even define each -- synthesized attribute individually with a SynthesizedField -- instance. class Attribution t g deep shallow -- | The attribution rule for a given transformation and node. attribution :: Attribution t g deep shallow => t -> shallow (g deep deep) -> Rule t g -- | Drop-in implementation of $ applyDefault :: (q ~ Semantics t, x ~ g q q, Apply (g q), Attribution t g q p) => (forall a. p a -> a) -> t -> p x -> q x -- | Drop-in implementation of $ that preserves all attributes with -- every original node applyDefaultWithAttributes :: (p ~ Domain t, q ~ PreservingSemantics t p, x ~ g q q, Apply (g q), Atts (Inherited t) (g q q) ~ Atts (Inherited t) (g (Semantics t) (Semantics t)), Atts (Synthesized t) (g q q) ~ Atts (Synthesized t) (g (Semantics t) (Semantics t)), g q (Synthesized t) ~ g (Semantics t) (Synthesized t), g q (Inherited t) ~ g (Semantics t) (Inherited t), Attribution t g (PreservingSemantics t p) p) => (forall a. p a -> a) -> t -> p (g (PreservingSemantics t p) (PreservingSemantics t p)) -> PreservingSemantics t p (g (PreservingSemantics t p) (PreservingSemantics t p)) instance GHC.Show.Show (Transformation.AG.Atts (Transformation.AG.Inherited t) a) => GHC.Show.Show (Transformation.AG.Inherited t a) instance GHC.Show.Show (Transformation.AG.Atts (Transformation.AG.Synthesized t) a) => GHC.Show.Show (Transformation.AG.Synthesized t a) -- | Type classes Functor, Foldable, and Traversable -- that correspond to the standard type classes of the same name, but -- applying the given transformation to the given tree node and all its -- descendants. The corresponding classes in the -- Transformation.Shallow moduleo perate only on the immediate -- children, while those from the Transformation.Deep module -- exclude the argument node itself. module Transformation.Full -- | Like Transformation.Deep.Functor except it maps an -- additional wrapper around the entire tree class (Transformation t, Functor (g (Domain t))) => Functor t g (<$>) :: Functor t g => t -> Domain t (g (Domain t) (Domain t)) -> Codomain t (g (Codomain t) (Codomain t)) infixl 4 <$> -- | Like Transformation.Deep.Foldable except the entire tree -- is also wrapped class (Transformation t, Foldable (g (Domain t))) => Foldable t g foldMap :: (Foldable t g, Codomain t ~ Const m, Monoid m) => t -> Domain t (g (Domain t) (Domain t)) -> m -- | Like Transformation.Deep.Traversable except it traverses -- an additional wrapper around the entire tree class (Transformation t, Traversable (g (Domain t))) => Traversable t g traverse :: (Traversable t g, Codomain t ~ Compose m f) => t -> Domain t (g (Domain t) (Domain t)) -> m (f (g f f)) -- | Alphabetical synonym for <$> fmap :: Functor t g => t -> Domain t (g (Domain t) (Domain t)) -> Codomain t (g (Codomain t) (Codomain t)) -- | Default implementation for <$> that maps the wrapper and -- then the tree mapDownDefault :: (Functor t g, t `At` g (Domain t) (Domain t), Functor (Codomain t)) => t -> Domain t (g (Domain t) (Domain t)) -> Codomain t (g (Codomain t) (Codomain t)) -- | Default implementation for <$> that maps the tree and -- then the wrapper mapUpDefault :: (Functor t g, t `At` g (Codomain t) (Codomain t), Functor (Domain t)) => t -> Domain t (g (Domain t) (Domain t)) -> Codomain t (g (Codomain t) (Codomain t)) -- | Default implementation for foldMap that folds the wrapper and -- then the tree foldMapDownDefault :: (t `At` g (Domain t) (Domain t), Foldable t g, Codomain t ~ Const m, Foldable (Domain t), Monoid m) => t -> Domain t (g (Domain t) (Domain t)) -> m -- | Default implementation for foldMap that folds the tree and then -- the wrapper foldMapUpDefault :: (t `At` g (Domain t) (Domain t), Foldable t g, Codomain t ~ Const m, Foldable (Domain t), Monoid m) => t -> Domain t (g (Domain t) (Domain t)) -> m -- | Default implementation for traverse that traverses the wrapper -- and then the tree traverseDownDefault :: (Traversable t g, t `At` g (Domain t) (Domain t), Codomain t ~ Compose m f, Traversable f, Monad m) => t -> Domain t (g (Domain t) (Domain t)) -> m (f (g f f)) -- | Default implementation for traverse that traverses the tree and -- then the wrapper traverseUpDefault :: (Traversable t g, Codomain t ~ Compose m f, t `At` g f f, Traversable (Domain t), Monad m) => t -> Domain t (g (Domain t) (Domain t)) -> m (f (g f f)) -- | Type classes Functor, Foldable, and Traversable -- that correspond to the standard type classes of the same name, but -- applying the given transformation to every descendant of the given -- tree node. The corresponding classes in the -- Transformation.Shallow module operate only on the immediate -- children, while those from the Transformation.Full module -- include the argument node itself. module Transformation.Deep -- | Like Transformation.Shallow.Functor except it maps all -- descendants and not only immediate children class (Transformation t, Functor (g (Domain t))) => Functor t g (<$>) :: Functor t g => t -> g (Domain t) (Domain t) -> g (Codomain t) (Codomain t) infixl 4 <$> -- | Like Transformation.Shallow.Foldable except it folds all -- descendants and not only immediate children class (Transformation t, Foldable (g (Domain t))) => Foldable t g foldMap :: (Foldable t g, Codomain t ~ Const m, Monoid m) => t -> g (Domain t) (Domain t) -> m -- | Like Transformation.Shallow.Traversable except it folds -- all descendants and not only immediate children class (Transformation t, Traversable (g (Domain t))) => Traversable t g traverse :: (Traversable t g, Codomain t ~ Compose m f) => t -> g (Domain t) (Domain t) -> m (g f f) -- | Like Product for data types with two type constructor -- parameters data Product g h (d :: Type -> Type) (s :: Type -> Type) Pair :: s (g d d) -> s (h d d) -> Product g h (d :: Type -> Type) (s :: Type -> Type) [fst] :: Product g h (d :: Type -> Type) (s :: Type -> Type) -> s (g d d) [snd] :: Product g h (d :: Type -> Type) (s :: Type -> Type) -> s (h d d) -- | Like Sum for data types with two type constructor parameters data Sum g h (d :: Type -> Type) (s :: Type -> Type) InL :: s (g d d) -> Sum g h (d :: Type -> Type) (s :: Type -> Type) InR :: s (h d d) -> Sum g h (d :: Type -> Type) (s :: Type -> Type) -- | Alphabetical synonym for <$> fmap :: Functor t g => t -> g (Domain t) (Domain t) -> g (Codomain t) (Codomain t) -- | Equivalent of either eitherFromSum :: Sum g h d s -> Either (s (g d d)) (s (h d d)) instance (Data.Typeable.Internal.Typeable p, Data.Typeable.Internal.Typeable q, Data.Typeable.Internal.Typeable g1, Data.Typeable.Internal.Typeable g2, Data.Data.Data (q (g1 p p)), Data.Data.Data (q (g2 p p))) => Data.Data.Data (Transformation.Deep.Product g1 g2 p q) instance (GHC.Show.Show (q (g1 p p)), GHC.Show.Show (q (g2 p p))) => GHC.Show.Show (Transformation.Deep.Product g1 g2 p q) instance (Data.Typeable.Internal.Typeable p, Data.Typeable.Internal.Typeable q, Data.Typeable.Internal.Typeable g1, Data.Typeable.Internal.Typeable g2, Data.Data.Data (q (g1 p p)), Data.Data.Data (q (g2 p p))) => Data.Data.Data (Transformation.Deep.Sum g1 g2 p q) instance (GHC.Show.Show (q (g1 p p)), GHC.Show.Show (q (g2 p p))) => GHC.Show.Show (Transformation.Deep.Sum g1 g2 p q) instance Rank2.Functor (Transformation.Deep.Sum g h p) instance Rank2.Foldable (Transformation.Deep.Sum g h p) instance Rank2.Traversable (Transformation.Deep.Sum g h p) instance (Transformation.Full.Functor t g, Transformation.Full.Functor t h) => Transformation.Deep.Functor t (Transformation.Deep.Sum g h) instance (Transformation.Full.Foldable t g, Transformation.Full.Foldable t h, Transformation.Codomain t GHC.Types.~ Data.Functor.Const.Const m) => Transformation.Deep.Foldable t (Transformation.Deep.Sum g h) instance (Transformation.Full.Traversable t g, Transformation.Full.Traversable t h, Transformation.Codomain t GHC.Types.~ Data.Functor.Compose.Compose m f, GHC.Base.Applicative m) => Transformation.Deep.Traversable t (Transformation.Deep.Sum g h) instance Rank2.Functor (Transformation.Deep.Product g h p) instance Rank2.Apply (Transformation.Deep.Product g h p) instance Rank2.Applicative (Transformation.Deep.Product g h p) instance Rank2.Foldable (Transformation.Deep.Product g h p) instance Rank2.Traversable (Transformation.Deep.Product g h p) instance Rank2.DistributiveTraversable (Transformation.Deep.Product g h p) instance Rank2.Distributive (Transformation.Deep.Product g h p) instance (Transformation.Full.Functor t g, Transformation.Full.Functor t h) => Transformation.Deep.Functor t (Transformation.Deep.Product g h) instance (Transformation.Full.Traversable t g, Transformation.Full.Traversable t h, Transformation.Codomain t GHC.Types.~ Data.Functor.Compose.Compose m f, GHC.Base.Applicative m) => Transformation.Deep.Traversable t (Transformation.Deep.Product g h) -- | This module exports the templates for automatic instance deriving of -- Transformation.Deep type classes. The most common way to use it -- would be -- --
--   import qualified Transformation.Deep.TH
--   data MyDataType f' f = ...
--   $(Transformation.Deep.TH.deriveFunctor ''MyDataType)
--   
module Transformation.Deep.TH deriveAll :: Name -> Q [Dec] deriveFunctor :: Name -> Q [Dec] deriveTraversable :: Name -> Q [Dec] -- | A special case of an attribute grammar where every node has only a -- single inherited and a single synthesized attribute of the same -- monoidal type. The synthesized attributes of child nodes are all -- mconcatted together. module Transformation.AG.Dimorphic -- | Transformation wrapper that allows automatic inference of attribute -- rules. newtype Auto t Auto :: t -> Auto t -- | Transformation wrapper that allows automatic inference of attribute -- rules and preservation of the attribute with the original nodes. newtype Keep t Keep :: t -> Keep t data Atts a b Atts :: a -> b -> Atts a b [inh] :: Atts a b -> a [syn] :: Atts a b -> b -- | A node's Semantics maps its inherited attribute to its -- synthesized attribute. type Semantics a b = Const (a -> b) -- | A node's PreservingSemantics maps its inherited attribute to -- its synthesized attribute. type PreservingSemantics f a b = Compose ((->) a) (Compose ((,) (Atts a b)) f) -- | An attribution rule maps a node's inherited attribute and its child -- nodes' synthesized attribute to the node's synthesized attribute and -- the children nodes' inherited attributes. type Rule a b = Atts a b -> Atts a b -- | The core function to tie the recursive knot, turning a Rule for -- a node into its Semantics. knit :: (Foldable (g sem), sem ~ Semantics a b, Monoid a, Monoid b) => Rule a b -> g sem sem -> sem (g sem sem) -- | Another way to tie the recursive knot, using a Rule to add -- attributes to every node througha stateful calculation knitKeeping :: forall a b f g sem. (Foldable (g sem), sem ~ PreservingSemantics f a b, Monoid a, Monoid b, Foldable f, Functor f) => Rule a b -> f (g sem sem) -> sem (g sem sem) -- | The core type class for defining the attribute grammar. The instances -- of this class typically have a form like -- --
--   instance Attribution MyAttGrammar MyMonoid MyNode (Semantics MyAttGrammar) Identity where
--     attribution MyAttGrammar{} (Identity MyNode{})
--                 Atts{inh= fromParent,
--                      syn= fromChildren}
--               = Atts{syn= toParent,
--                      inh= toChildren}
--   
class Attribution t a b g (deep :: Type -> Type) shallow -- | The attribution rule for a given transformation and node. attribution :: Attribution t a b g deep shallow => t -> shallow (g deep deep) -> Rule a b -- | Drop-in implementation of $ applyDefault :: (p ~ Domain t, q ~ Semantics a b, x ~ g q q, Foldable (g q), Attribution t a b g q p, Monoid a, Monoid b) => (forall y. p y -> y) -> t -> p x -> q x -- | Drop-in implementation of <$> fullMapDefault :: (p ~ Domain t, q ~ Semantics a b, q ~ Codomain t, x ~ g q q, Foldable (g q), Functor t g, Attribution t a b g p p, Monoid a, Monoid b) => (forall y. p y -> y) -> t -> p (g p p) -> q (g q q) -- | Drop-in implementation of $ that stores all attributes with -- every original node applyDefaultWithAttributes :: (p ~ Domain t, q ~ PreservingSemantics p a b, x ~ g q q, Attribution t a b g q p, Foldable (g q), Monoid a, Monoid b, Foldable p, Functor p) => t -> p x -> q x -- | Drop-in implementation of traverse that stores all attributes -- with every original node traverseDefaultWithAttributes :: forall t p q r a b g. (Transformation t, Domain t ~ p, Codomain t ~ Compose ((->) a) q, q ~ Compose ((,) (Atts a b)) p, r ~ Compose ((->) a) q, Traversable p, Functor t g, Traversable (Feeder a b p) g, At t (g r r)) => t -> p (g p p) -> a -> q (g q q) data Feeder a b (f :: Type -> Type) Feeder :: Feeder a b (f :: Type -> Type) type FeederDomain a b f = Compose ((->) a) (Compose ((,) (Atts a b)) f) instance (GHC.Show.Show a, GHC.Show.Show b) => GHC.Show.Show (Transformation.AG.Dimorphic.Atts a b) instance (Data.Data.Data a, Data.Data.Data b) => Data.Data.Data (Transformation.AG.Dimorphic.Atts a b) instance Transformation.Transformation (Transformation.AG.Dimorphic.Feeder a b f) instance (Data.Traversable.Traversable f, Rank2.Traversable (g (Transformation.AG.Dimorphic.FeederDomain a b f)), Transformation.Deep.Traversable (Transformation.AG.Dimorphic.Feeder a b f) g) => Transformation.Full.Traversable (Transformation.AG.Dimorphic.Feeder a b f) g instance (Transformation.Transformation (Transformation.AG.Dimorphic.Keep t), Transformation.Domain (Transformation.AG.Dimorphic.Keep t) GHC.Types.~ f, Data.Traversable.Traversable f, Rank2.Traversable (g f), Transformation.Codomain (Transformation.AG.Dimorphic.Keep t) GHC.Types.~ Transformation.AG.Dimorphic.PreservingSemantics f a b, Transformation.Deep.Traversable (Transformation.AG.Dimorphic.Feeder a b f) g, Transformation.Full.Functor (Transformation.AG.Dimorphic.Keep t) g, Transformation.At (Transformation.AG.Dimorphic.Keep t) (g (Transformation.AG.Dimorphic.PreservingSemantics f a b) (Transformation.AG.Dimorphic.PreservingSemantics f a b))) => Transformation.Full.Traversable (Transformation.AG.Dimorphic.Keep t) g instance Transformation.At (Transformation.AG.Dimorphic.Feeder a b f) g instance Transformation.AG.Dimorphic.Attribution t a b g deep shallow instance (Transformation.Transformation (Transformation.AG.Dimorphic.Auto t), p GHC.Types.~ Transformation.Domain (Transformation.AG.Dimorphic.Auto t), q GHC.Types.~ Transformation.Codomain (Transformation.AG.Dimorphic.Auto t), q GHC.Types.~ Transformation.AG.Dimorphic.Semantics a b, Rank2.Foldable (g q), GHC.Base.Monoid a, GHC.Base.Monoid b, Data.Foldable.Foldable p, Transformation.AG.Dimorphic.Attribution (Transformation.AG.Dimorphic.Auto t) a b g q p) => Transformation.At (Transformation.AG.Dimorphic.Auto t) (g (Transformation.AG.Dimorphic.Semantics a b) (Transformation.AG.Dimorphic.Semantics a b)) instance (Transformation.Transformation (Transformation.AG.Dimorphic.Keep t), p GHC.Types.~ Transformation.Domain (Transformation.AG.Dimorphic.Keep t), q GHC.Types.~ Transformation.Codomain (Transformation.AG.Dimorphic.Keep t), q GHC.Types.~ Transformation.AG.Dimorphic.PreservingSemantics p a b, Rank2.Foldable (g q), GHC.Base.Monoid a, GHC.Base.Monoid b, Data.Foldable.Foldable p, GHC.Base.Functor p, Transformation.AG.Dimorphic.Attribution (Transformation.AG.Dimorphic.Keep t) a b g q p) => Transformation.At (Transformation.AG.Dimorphic.Keep t) (g (Transformation.AG.Dimorphic.PreservingSemantics p a b) (Transformation.AG.Dimorphic.PreservingSemantics p a b)) instance (Transformation.Transformation (Transformation.AG.Dimorphic.Keep t), Transformation.Domain (Transformation.AG.Dimorphic.Keep t) GHC.Types.~ f, GHC.Base.Functor f, Transformation.Codomain (Transformation.AG.Dimorphic.Keep t) GHC.Types.~ Transformation.AG.Dimorphic.PreservingSemantics f a b, Rank2.Functor (g f), Transformation.Deep.Functor (Transformation.AG.Dimorphic.Keep t) g, Transformation.At (Transformation.AG.Dimorphic.Keep t) (g (Transformation.AG.Dimorphic.PreservingSemantics f a b) (Transformation.AG.Dimorphic.PreservingSemantics f a b))) => Transformation.Full.Functor (Transformation.AG.Dimorphic.Keep t) g instance (Transformation.Transformation (Transformation.AG.Dimorphic.Auto t), Transformation.Domain (Transformation.AG.Dimorphic.Auto t) GHC.Types.~ f, GHC.Base.Functor f, Transformation.Codomain (Transformation.AG.Dimorphic.Auto t) GHC.Types.~ Transformation.AG.Dimorphic.Semantics a b, Rank2.Functor (g f), Transformation.Deep.Functor (Transformation.AG.Dimorphic.Auto t) g, Transformation.At (Transformation.AG.Dimorphic.Auto t) (g (Transformation.AG.Dimorphic.Semantics a b) (Transformation.AG.Dimorphic.Semantics a b))) => Transformation.Full.Functor (Transformation.AG.Dimorphic.Auto t) g instance (GHC.Base.Semigroup a, GHC.Base.Semigroup b) => GHC.Base.Semigroup (Transformation.AG.Dimorphic.Atts a b) instance (GHC.Base.Monoid a, GHC.Base.Monoid b) => GHC.Base.Monoid (Transformation.AG.Dimorphic.Atts a b) -- | A special case of an attribute grammar where every node has only a -- single inherited and a single synthesized attribute of the same -- monoidal type. The synthesized attributes of child nodes are all -- mconcatted together. module Transformation.AG.Monomorphic -- | Transformation wrapper that allows automatic inference of attribute -- rules. newtype Auto t Auto :: t -> Auto t -- | Transformation wrapper that allows automatic inference of attribute -- rules and preservation of the attribute with the original nodes. newtype Keep t Keep :: t -> Keep t type Atts a = Atts a a pattern Atts :: a -> a -> Atts a inh :: Atts a -> a syn :: Atts a -> a -- | A node's Semantics maps its inherited attribute to its -- synthesized attribute. type Semantics a = Const (a -> a) -- | A node's PreservingSemantics maps its inherited attribute to -- its synthesized attribute. type PreservingSemantics f a = Compose ((->) a) (Compose ((,) (Atts a)) f) -- | An attribution rule maps a node's inherited attribute and its child -- nodes' synthesized attribute to the node's synthesized attribute and -- the children nodes' inherited attributes. type Rule a = Atts a -> Atts a -- | The core type class for defining the attribute grammar. The instances -- of this class typically have a form like -- --
--   instance Attribution MyAttGrammar MyMonoid MyNode (Semantics MyAttGrammar) Identity where
--     attribution MyAttGrammar{} (Identity MyNode{})
--                 Atts{inh= fromParent,
--                      syn= fromChildren}
--               = Atts{syn= toParent,
--                      inh= toChildren}
--   
class Attribution t a g (deep :: Type -> Type) shallow -- | The attribution rule for a given transformation and node. attribution :: Attribution t a g deep shallow => t -> shallow (g deep deep) -> Rule a type Feeder a = Feeder a a -- | The core function to tie the recursive knot, turning a Rule for -- a node into its Semantics. knit :: (Foldable (g sem), sem ~ Semantics a b, Monoid a, Monoid b) => Rule a b -> g sem sem -> sem (g sem sem) -- | Another way to tie the recursive knot, using a Rule to add -- attributes to every node througha stateful calculation knitKeeping :: forall a b f g sem. (Foldable (g sem), sem ~ PreservingSemantics f a b, Monoid a, Monoid b, Foldable f, Functor f) => Rule a b -> f (g sem sem) -> sem (g sem sem) -- | Drop-in implementation of $ applyDefault :: (p ~ Domain t, q ~ Semantics a, x ~ g q q, Foldable (g q), Attribution t a g q p, Monoid a) => (forall y. p y -> y) -> t -> p x -> q x -- | Drop-in implementation of $ that stores all attributes with -- every original node applyDefaultWithAttributes :: (p ~ Domain t, q ~ PreservingSemantics p a, x ~ g q q, Attribution t a g q p, Foldable (g q), Monoid a, Foldable p, Functor p) => t -> p x -> q x -- | Drop-in implementation of <$> fullMapDefault :: (p ~ Domain t, q ~ Semantics a, q ~ Codomain t, x ~ g q q, Foldable (g q), Functor t g, Attribution t a g p p, Monoid a) => (forall y. p y -> y) -> t -> p (g p p) -> q (g q q) -- | Drop-in implementation of traverse that stores all attributes -- with every original node traverseDefaultWithAttributes :: forall t p q r a b g. (Transformation t, Domain t ~ p, Codomain t ~ Compose ((->) a) q, q ~ Compose ((,) (Atts a b)) p, r ~ Compose ((->) a) q, Traversable p, Functor t g, Traversable (Feeder a b p) g, At t (g r r)) => t -> p (g p p) -> a -> q (g q q) instance (Transformation.Transformation (Transformation.AG.Monomorphic.Keep t), Transformation.Domain (Transformation.AG.Monomorphic.Keep t) GHC.Types.~ f, Data.Traversable.Traversable f, Rank2.Traversable (g f), Transformation.Codomain (Transformation.AG.Monomorphic.Keep t) GHC.Types.~ Transformation.AG.Monomorphic.PreservingSemantics f a, Transformation.Deep.Traversable (Transformation.AG.Monomorphic.Feeder a f) g, Transformation.Full.Functor (Transformation.AG.Monomorphic.Keep t) g, Transformation.At (Transformation.AG.Monomorphic.Keep t) (g (Transformation.AG.Monomorphic.PreservingSemantics f a) (Transformation.AG.Monomorphic.PreservingSemantics f a))) => Transformation.Full.Traversable (Transformation.AG.Monomorphic.Keep t) g instance Transformation.AG.Monomorphic.Attribution t a g deep shallow instance (Transformation.Transformation (Transformation.AG.Monomorphic.Auto t), p GHC.Types.~ Transformation.Domain (Transformation.AG.Monomorphic.Auto t), q GHC.Types.~ Transformation.Codomain (Transformation.AG.Monomorphic.Auto t), q GHC.Types.~ Transformation.AG.Monomorphic.Semantics a, Rank2.Foldable (g q), GHC.Base.Monoid a, Data.Foldable.Foldable p, Transformation.AG.Monomorphic.Attribution (Transformation.AG.Monomorphic.Auto t) a g q p) => Transformation.At (Transformation.AG.Monomorphic.Auto t) (g (Transformation.AG.Monomorphic.Semantics a) (Transformation.AG.Monomorphic.Semantics a)) instance (Transformation.Transformation (Transformation.AG.Monomorphic.Keep t), p GHC.Types.~ Transformation.Domain (Transformation.AG.Monomorphic.Keep t), q GHC.Types.~ Transformation.Codomain (Transformation.AG.Monomorphic.Keep t), q GHC.Types.~ Transformation.AG.Monomorphic.PreservingSemantics p a, Rank2.Foldable (g q), GHC.Base.Monoid a, Data.Foldable.Foldable p, GHC.Base.Functor p, Transformation.AG.Monomorphic.Attribution (Transformation.AG.Monomorphic.Keep t) a g q p) => Transformation.At (Transformation.AG.Monomorphic.Keep t) (g (Transformation.AG.Monomorphic.PreservingSemantics p a) (Transformation.AG.Monomorphic.PreservingSemantics p a)) instance (Transformation.Transformation (Transformation.AG.Monomorphic.Keep t), Transformation.Domain (Transformation.AG.Monomorphic.Keep t) GHC.Types.~ f, GHC.Base.Functor f, Transformation.Codomain (Transformation.AG.Monomorphic.Keep t) GHC.Types.~ Transformation.AG.Monomorphic.PreservingSemantics f a, GHC.Base.Functor f, Rank2.Functor (g f), Transformation.Deep.Functor (Transformation.AG.Monomorphic.Keep t) g, Transformation.At (Transformation.AG.Monomorphic.Keep t) (g (Transformation.AG.Monomorphic.PreservingSemantics f a) (Transformation.AG.Monomorphic.PreservingSemantics f a))) => Transformation.Full.Functor (Transformation.AG.Monomorphic.Keep t) g instance (Transformation.Transformation (Transformation.AG.Monomorphic.Auto t), Transformation.Domain (Transformation.AG.Monomorphic.Auto t) GHC.Types.~ f, GHC.Base.Functor f, Transformation.Codomain (Transformation.AG.Monomorphic.Auto t) GHC.Types.~ Transformation.AG.Monomorphic.Semantics a, Rank2.Functor (g f), Transformation.Deep.Functor (Transformation.AG.Monomorphic.Auto t) g, Transformation.At (Transformation.AG.Monomorphic.Auto t) (g (Transformation.AG.Monomorphic.Semantics a) (Transformation.AG.Monomorphic.Semantics a))) => Transformation.Full.Functor (Transformation.AG.Monomorphic.Auto t) g -- | This module exports the templates for automatic instance deriving of -- Transformation.Full type classes. The most common way to use it -- would be -- --
--   import qualified Transformation.Full.TH
--   data MyDataType f' f = ...
--   $(Transformation.Full.TH.deriveUpFunctor (conT ''MyTransformation) (conT ''MyDataType))
--   
module Transformation.Full.TH deriveDownFunctor :: Q Type -> Q Type -> Q [Dec] deriveDownFoldable :: Q Type -> Q Type -> Q [Dec] deriveDownTraversable :: Q Type -> Q Type -> Q [Dec] deriveUpFunctor :: Q Type -> Q Type -> Q [Dec] deriveUpFoldable :: Q Type -> Q Type -> Q [Dec] deriveUpTraversable :: Q Type -> Q Type -> Q [Dec] -- | This module provides natural transformations Map, Fold, -- and Traversal, as well as three rank-2 functions that wrap them -- in a convenient interface. module Transformation.Rank2 -- | Transform (naturally) the containing functor of every node in the -- given tree. (<$>) :: Functor (Map p q) g => (forall a. p a -> q a) -> g p p -> g q q infixl 4 <$> -- | Fold the containing functor of every node in the given tree. foldMap :: (Foldable (Fold p m) g, Monoid m) => (forall a. p a -> m) -> g p p -> m -- | Traverse the containing functors of all nodes in the given tree. traverse :: Traversable (Traversal p q m) g => (forall a. p a -> m (q a)) -> g p p -> m (g q q) newtype Map p q Map :: (forall x. p x -> q x) -> Map p q newtype Fold p m Fold :: (forall x. p x -> m) -> Fold p m newtype Traversal p q m Traversal :: (forall x. p x -> m (q x)) -> Traversal p q m instance Transformation.Transformation (Transformation.Rank2.Traversal p q m) instance Transformation.At (Transformation.Rank2.Traversal p q m) x instance Transformation.Transformation (Transformation.Rank2.Fold p m) instance Transformation.At (Transformation.Rank2.Fold p m) x instance Transformation.Transformation (Transformation.Rank2.Map p q) instance Transformation.At (Transformation.Rank2.Map p q) x instance (Rank2.Functor (g p), Transformation.Deep.Functor (Transformation.Rank2.Map p q) g, GHC.Base.Functor p) => Transformation.Full.Functor (Transformation.Rank2.Map p q) g -- | Type classes Functor, Foldable, and Traversable -- that correspond to the standard type classes of the same name. The -- rank2classes package provides the equivalent set of classes for -- natural transformations. This module extends the functionality to -- unnatural transformations. module Transformation.Shallow -- | Like Rank2.Functor except it takes a Transformation -- instead of a polymorphic function class (Transformation t, Functor g) => Functor t g (<$>) :: Functor t g => t -> g (Domain t) -> g (Codomain t) infixl 4 <$> -- | Like Rank2.Foldable except it takes a Transformation -- instead of a polymorphic function class (Transformation t, Foldable g) => Foldable t g foldMap :: (Foldable t g, Codomain t ~ Const m, Monoid m) => t -> g (Domain t) -> m -- | Like Rank2.Traversable except it takes a Transformation -- instead of a polymorphic function class (Transformation t, Traversable g) => Traversable t g traverse :: (Traversable t g, Codomain t ~ Compose m f) => t -> g (Domain t) -> m (g f) -- | Alphabetical synonym for <$> fmap :: Functor t g => t -> g (Domain t) -> g (Codomain t) instance (Transformation.Shallow.Traversable t g, Transformation.Shallow.Traversable t h, Transformation.Codomain t GHC.Types.~ Data.Functor.Compose.Compose m f, GHC.Base.Applicative m) => Transformation.Shallow.Traversable t (Data.Functor.Product.Product g h) instance (Transformation.Shallow.Foldable t g, Transformation.Shallow.Foldable t h, Transformation.Codomain t GHC.Types.~ Data.Functor.Const.Const m, GHC.Base.Monoid m) => Transformation.Shallow.Foldable t (Data.Functor.Product.Product g h) instance (Transformation.Shallow.Functor t g, Transformation.Shallow.Functor t h) => Transformation.Shallow.Functor t (Data.Functor.Product.Product g h) -- | This module can be used to scrap the boilerplate attribute -- declarations. In particular: -- -- module Transformation.AG.Generics -- | Transformation wrapper that allows automatic inference of attribute -- rules. newtype Auto t Auto :: t -> Auto t -- | Transformation wrapper that allows automatic inference of attribute -- rules and preservation of all attributes with the original nodes. newtype Keep t Keep :: t -> Keep t -- | Wrapper for a field that should be automatically synthesized by -- folding together all child nodes' synthesized attributes of the same -- name. newtype Folded a Folded :: a -> Folded a [getFolded] :: Folded a -> a -- | Wrapper for a field that should be automatically synthesized by -- replacing every child node by its synthesized attribute of the same -- name. newtype Mapped f a Mapped :: f a -> Mapped f a [getMapped] :: Mapped f a -> f a -- | Wrapper for a field that should be automatically synthesized by -- traversing over all child nodes and applying each node's synthesized -- attribute of the same name. newtype Traversed m f a Traversed :: m (f a) -> Traversed m f a [getTraversed] :: Traversed m f a -> m (f a) -- | A half of the Attribution class used to specify all inherited -- attributes. class Bequether t g deep shallow bequest :: forall sem. (Bequether t g deep shallow, sem ~ Semantics t) => t -> shallow (g deep deep) -> Atts (Inherited t) (g sem sem) -> g sem (Synthesized t) -> g sem (Inherited t) -- | A half of the Attribution class used to specify all synthesized -- attributes. class Synthesizer t g deep shallow synthesis :: forall sem. (Synthesizer t g deep shallow, sem ~ Semantics t) => t -> shallow (g deep deep) -> Atts (Inherited t) (g sem sem) -> g sem (Synthesized t) -> Atts (Synthesized t) (g sem sem) -- | Class for specifying a single named attribute class SynthesizedField (name :: Symbol) result t g deep shallow synthesizedField :: forall sem. (SynthesizedField name result t g deep shallow, sem ~ Semantics t) => Proxy name -> t -> shallow (g deep deep) -> Atts (Inherited t) (g sem sem) -> g sem (Synthesized t) -> result class Transformation t => Revelation t -- | Extract the value from the transformation domain reveal :: Revelation t => t -> Domain t x -> x -- | The default synthesizedField method definition for -- Folded fields. foldedField :: forall name t g a sem. (Monoid a, Foldable (Accumulator t name a) (g sem)) => Proxy name -> t -> g sem (Synthesized t) -> Folded a -- | The default synthesizedField method definition for -- Mapped fields. mappedField :: forall name t g f sem. (Functor (Replicator t f name) (g f), Atts (Synthesized t) (g sem sem) ~ Atts (Synthesized t) (g f f)) => Proxy name -> t -> g sem (Synthesized t) -> g f f -- | Pass down the given record of inherited fields to child nodes. passDown :: forall t g shallow deep atts. Functor (PassDown t shallow atts) (g deep) => atts -> g deep shallow -> g deep (Inherited t) -- | The default bequest method definition relies on generics to -- automatically pass down all same-named inherited attributes. bequestDefault :: forall t g shallow sem. (sem ~ Semantics t, Domain t ~ shallow, Revelation t, Functor (PassDown t sem (Atts (Inherited t) (g sem sem))) (g sem)) => t -> shallow (g sem sem) -> Atts (Inherited t) (g sem sem) -> g sem (Synthesized t) -> g sem (Inherited t) instance GHC.Base.Monoid a => GHC.Base.Monoid (Transformation.AG.Generics.Folded a) instance GHC.Base.Semigroup a => GHC.Base.Semigroup (Transformation.AG.Generics.Folded a) instance GHC.Show.Show a => GHC.Show.Show (Transformation.AG.Generics.Folded a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Transformation.AG.Generics.Folded a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Transformation.AG.Generics.Folded a) instance Data.Foldable.Foldable f => Data.Foldable.Foldable (Transformation.AG.Generics.Mapped f) instance GHC.Base.Monad f => GHC.Base.Monad (Transformation.AG.Generics.Mapped f) instance GHC.Base.Applicative f => GHC.Base.Applicative (Transformation.AG.Generics.Mapped f) instance GHC.Base.Functor f => GHC.Base.Functor (Transformation.AG.Generics.Mapped f) instance forall k (f :: k -> *) (a :: k). GHC.Base.Monoid (f a) => GHC.Base.Monoid (Transformation.AG.Generics.Mapped f a) instance forall k (f :: k -> *) (a :: k). GHC.Base.Semigroup (f a) => GHC.Base.Semigroup (Transformation.AG.Generics.Mapped f a) instance forall k (f :: k -> *) (a :: k). GHC.Show.Show (f a) => GHC.Show.Show (Transformation.AG.Generics.Mapped f a) instance forall k (f :: k -> *) (a :: k). GHC.Classes.Ord (f a) => GHC.Classes.Ord (Transformation.AG.Generics.Mapped f a) instance forall k (f :: k -> *) (a :: k). GHC.Classes.Eq (f a) => GHC.Classes.Eq (Transformation.AG.Generics.Mapped f a) instance forall k1 (m :: k1 -> *) k2 (f :: k2 -> k1) (a :: k2). GHC.Base.Monoid (m (f a)) => GHC.Base.Monoid (Transformation.AG.Generics.Traversed m f a) instance forall k1 (m :: k1 -> *) k2 (f :: k2 -> k1) (a :: k2). GHC.Base.Semigroup (m (f a)) => GHC.Base.Semigroup (Transformation.AG.Generics.Traversed m f a) instance forall k1 (m :: k1 -> *) k2 (f :: k2 -> k1) (a :: k2). GHC.Show.Show (m (f a)) => GHC.Show.Show (Transformation.AG.Generics.Traversed m f a) instance forall k1 (m :: k1 -> *) k2 (f :: k2 -> k1) (a :: k2). GHC.Classes.Ord (m (f a)) => GHC.Classes.Ord (Transformation.AG.Generics.Traversed m f a) instance forall k1 (m :: k1 -> *) k2 (f :: k2 -> k1) (a :: k2). GHC.Classes.Eq (m (f a)) => GHC.Classes.Eq (Transformation.AG.Generics.Traversed m f a) instance forall k a (f :: k -> *) (name :: GHC.Types.Symbol) i (su :: GHC.Generics.SourceUnpackedness) (ss :: GHC.Generics.SourceStrictness) (ds :: GHC.Generics.DecidedStrictness). Transformation.AG.Generics.FoundField a f => Transformation.AG.Generics.MayHaveMonoidalField name a (GHC.Generics.M1 i ('GHC.Generics.MetaSel ('GHC.Maybe.Just name) su ss ds) f) instance forall k a (f :: k -> *) i (j :: GHC.Generics.Meta). Transformation.AG.Generics.FoundField a f => Transformation.AG.Generics.FoundField a (GHC.Generics.M1 i j f) instance Transformation.AG.Generics.FoundField a (GHC.Generics.K1 i a) instance (GHC.Base.Monoid a, r GHC.Types.~ Transformation.AG.Atts (Transformation.AG.Synthesized t) x, GHC.Generics.Generic r, Transformation.AG.Generics.MayHaveMonoidalField name (Transformation.AG.Generics.Folded a) (GHC.Generics.Rep r)) => Transformation.At (Transformation.AG.Generics.Accumulator t name a) x instance forall k (name :: GHC.Types.Symbol) a (x :: k -> *) (y :: k -> *). (Transformation.AG.Generics.MayHaveMonoidalField name a x, Transformation.AG.Generics.MayHaveMonoidalField name a y, GHC.Base.Semigroup a) => Transformation.AG.Generics.MayHaveMonoidalField name a (x GHC.Generics.:*: y) instance forall k (name :: GHC.Types.Symbol) a (x :: k -> *) (y :: k -> *). (TypeError ...) => Transformation.AG.Generics.MayHaveMonoidalField name a (x GHC.Generics.:+: y) instance forall k a (name :: GHC.Types.Symbol) i (su :: GHC.Generics.SourceUnpackedness) (ss :: GHC.Generics.SourceStrictness) (ds :: GHC.Generics.DecidedStrictness) (f :: k -> *). GHC.Base.Monoid a => Transformation.AG.Generics.MayHaveMonoidalField name a (GHC.Generics.M1 i ('GHC.Generics.MetaSel 'GHC.Maybe.Nothing su ss ds) f) instance forall k (name :: GHC.Types.Symbol) a (f :: k -> *) i (n :: GHC.Types.Symbol) (m :: GHC.Types.Symbol) (p :: GHC.Types.Symbol) (nt :: GHC.Types.Bool). Transformation.AG.Generics.MayHaveMonoidalField name a f => Transformation.AG.Generics.MayHaveMonoidalField name a (GHC.Generics.M1 i ('GHC.Generics.MetaData n m p nt) f) instance forall k (name :: GHC.Types.Symbol) a (f :: k -> *) i (n :: GHC.Types.Symbol) (fi :: GHC.Generics.FixityI) (s :: GHC.Types.Bool). Transformation.AG.Generics.MayHaveMonoidalField name a f => Transformation.AG.Generics.MayHaveMonoidalField name a (GHC.Generics.M1 i ('GHC.Generics.MetaCons n fi s) f) instance forall k a (name :: GHC.Types.Symbol) (f :: k -> *). GHC.Base.Monoid a => Transformation.AG.Generics.MayHaveMonoidalField name a f instance forall k (name :: GHC.Types.Symbol) (f :: k -> *) t (g :: (* -> *) -> (* -> *) -> *) (deep :: * -> *) (shallow :: * -> *) i (su :: GHC.Generics.SourceUnpackedness) (ss :: GHC.Generics.SourceStrictness) (ds :: GHC.Generics.DecidedStrictness). Transformation.AG.Generics.GenericSynthesizedField name f t g deep shallow => Transformation.AG.Generics.GenericSynthesizer t g deep shallow (GHC.Generics.M1 i ('GHC.Generics.MetaSel ('GHC.Maybe.Just name) su ss ds) f) instance Transformation.AG.Generics.SynthesizedField name a t g deep shallow => Transformation.AG.Generics.GenericSynthesizedField name (GHC.Generics.K1 i a) t g deep shallow instance (Transformation.AG.Atts (Transformation.AG.Synthesized t) (g sem sem) GHC.Types.~ result, GHC.Generics.Generic result, sem GHC.Types.~ Transformation.AG.Semantics t, Transformation.AG.Generics.GenericSynthesizer t g d s (GHC.Generics.Rep result)) => Transformation.AG.Generics.Synthesizer t g d s instance forall k t (g :: (* -> *) -> (* -> *) -> *) (deep :: * -> *) (shallow :: * -> *) (x :: k -> *) (y :: k -> *). (Transformation.AG.Generics.GenericSynthesizer t g deep shallow x, Transformation.AG.Generics.GenericSynthesizer t g deep shallow y) => Transformation.AG.Generics.GenericSynthesizer t g deep shallow (x GHC.Generics.:*: y) instance forall k t (g :: (* -> *) -> (* -> *) -> *) (deep :: * -> *) (shallow :: * -> *) (f :: k -> *) i (meta :: GHC.Generics.Meta). Transformation.AG.Generics.GenericSynthesizer t g deep shallow f => Transformation.AG.Generics.GenericSynthesizer t g deep shallow (GHC.Generics.M1 i meta f) instance Transformation.Transformation (Transformation.AG.Generics.Traverser t m f name) instance GHC.Records.HasField name (Transformation.AG.Atts (Transformation.AG.Synthesized t) a) (Transformation.AG.Generics.Traversed m f a) => Transformation.At (Transformation.AG.Generics.Traverser t m f name) a instance (Data.Traversable.Traversable f, GHC.Base.Applicative m, Transformation.Shallow.Traversable (Transformation.AG.Generics.Traverser t m f name) (g f), Transformation.AG.Atts (Transformation.AG.Synthesized t) (g (Transformation.AG.Semantics t) (Transformation.AG.Semantics t)) GHC.Types.~ Transformation.AG.Atts (Transformation.AG.Synthesized t) (g f f)) => Transformation.AG.Generics.SynthesizedField name (Transformation.AG.Generics.Traversed m f (g f f)) t g deep f instance Transformation.Transformation (Transformation.AG.Generics.Replicator t f name) instance GHC.Records.HasField name (Transformation.AG.Atts (Transformation.AG.Synthesized t) a) (Transformation.AG.Generics.Mapped f a) => Transformation.At (Transformation.AG.Generics.Replicator t f name) a instance (GHC.Base.Functor f, Transformation.Shallow.Functor (Transformation.AG.Generics.Replicator t f name) (g f), Transformation.AG.Atts (Transformation.AG.Synthesized t) (g (Transformation.AG.Semantics t) (Transformation.AG.Semantics t)) GHC.Types.~ Transformation.AG.Atts (Transformation.AG.Synthesized t) (g f f)) => Transformation.AG.Generics.SynthesizedField name (Transformation.AG.Generics.Mapped f (g f f)) t g deep f instance Transformation.Transformation (Transformation.AG.Generics.Accumulator t name a) instance (GHC.Base.Monoid a, Transformation.Shallow.Foldable (Transformation.AG.Generics.Accumulator t name a) (g (Transformation.AG.Semantics t))) => Transformation.AG.Generics.SynthesizedField name (Transformation.AG.Generics.Folded a) t g deep shallow instance (sem GHC.Types.~ Transformation.AG.Semantics t, Transformation.Domain t GHC.Types.~ shallow, Transformation.AG.Generics.Revelation t, Transformation.Shallow.Functor (Transformation.AG.Generics.PassDown t sem (Transformation.AG.Atts (Transformation.AG.Inherited t) (g sem sem))) (g sem)) => Transformation.AG.Generics.Bequether t g (Transformation.AG.Semantics t) shallow instance Transformation.Transformation (Transformation.AG.Generics.PassDown t f a) instance Data.Generics.Product.Subtype.Subtype (Transformation.AG.Atts (Transformation.AG.Inherited t) a) b => Transformation.At (Transformation.AG.Generics.PassDown t f b) a instance (GHC.Base.Functor m, GHC.Base.Functor f) => GHC.Base.Functor (Transformation.AG.Generics.Traversed m f) instance (Transformation.AG.Generics.Bequether (Transformation.AG.Generics.Auto t) g d s, Transformation.AG.Generics.Synthesizer (Transformation.AG.Generics.Auto t) g d s) => Transformation.AG.Attribution (Transformation.AG.Generics.Auto t) g d s instance (Transformation.AG.Generics.Revelation (Transformation.AG.Generics.Auto t), Transformation.Domain (Transformation.AG.Generics.Auto t) GHC.Types.~ f, Transformation.Codomain (Transformation.AG.Generics.Auto t) GHC.Types.~ Transformation.AG.Semantics (Transformation.AG.Generics.Auto t), Rank2.Apply (g (Transformation.AG.Semantics (Transformation.AG.Generics.Auto t))), Transformation.AG.Attribution (Transformation.AG.Generics.Auto t) g (Transformation.AG.Semantics (Transformation.AG.Generics.Auto t)) f) => Transformation.At (Transformation.AG.Generics.Auto t) (g (Transformation.AG.Semantics (Transformation.AG.Generics.Auto t)) (Transformation.AG.Semantics (Transformation.AG.Generics.Auto t))) instance (Transformation.AG.Generics.Revelation (Transformation.AG.Generics.Keep t), p GHC.Types.~ Transformation.Domain (Transformation.AG.Generics.Keep t), Rank2.Apply (g q), q GHC.Types.~ Transformation.Codomain (Transformation.AG.Generics.Keep t), q GHC.Types.~ Transformation.AG.PreservingSemantics (Transformation.AG.Generics.Keep t) p, s GHC.Types.~ Transformation.AG.Semantics (Transformation.AG.Generics.Keep t), Transformation.AG.Atts (Transformation.AG.Inherited (Transformation.AG.Generics.Keep t)) (g q q) GHC.Types.~ Transformation.AG.Atts (Transformation.AG.Inherited (Transformation.AG.Generics.Keep t)) (g s s), Transformation.AG.Atts (Transformation.AG.Synthesized (Transformation.AG.Generics.Keep t)) (g q q) GHC.Types.~ Transformation.AG.Atts (Transformation.AG.Synthesized (Transformation.AG.Generics.Keep t)) (g s s), g q (Transformation.AG.Synthesized (Transformation.AG.Generics.Keep t)) GHC.Types.~ g s (Transformation.AG.Synthesized (Transformation.AG.Generics.Keep t)), g q (Transformation.AG.Inherited (Transformation.AG.Generics.Keep t)) GHC.Types.~ g s (Transformation.AG.Inherited (Transformation.AG.Generics.Keep t)), Transformation.AG.Attribution (Transformation.AG.Generics.Keep t) g q p) => Transformation.At (Transformation.AG.Generics.Keep t) (g (Transformation.AG.PreservingSemantics (Transformation.AG.Generics.Keep t) p) (Transformation.AG.PreservingSemantics (Transformation.AG.Generics.Keep t) p)) instance (Transformation.Transformation (Transformation.AG.Generics.Keep t), Transformation.Domain (Transformation.AG.Generics.Keep t) GHC.Types.~ f, GHC.Base.Functor f, Transformation.Codomain (Transformation.AG.Generics.Keep t) GHC.Types.~ Transformation.AG.PreservingSemantics (Transformation.AG.Generics.Keep t) f, GHC.Base.Functor f, Rank2.Functor (g f), Transformation.Deep.Functor (Transformation.AG.Generics.Keep t) g, Transformation.At (Transformation.AG.Generics.Keep t) (g (Transformation.AG.PreservingSemantics (Transformation.AG.Generics.Keep t) f) (Transformation.AG.PreservingSemantics (Transformation.AG.Generics.Keep t) f))) => Transformation.Full.Functor (Transformation.AG.Generics.Keep t) g instance (Transformation.Transformation (Transformation.AG.Generics.Auto t), Transformation.Domain (Transformation.AG.Generics.Auto t) GHC.Types.~ f, GHC.Base.Functor f, Transformation.Codomain (Transformation.AG.Generics.Auto t) GHC.Types.~ Transformation.AG.Semantics (Transformation.AG.Generics.Auto t), Rank2.Functor (g f), Transformation.Deep.Functor (Transformation.AG.Generics.Auto t) g, Transformation.At (Transformation.AG.Generics.Auto t) (g (Transformation.AG.Semantics (Transformation.AG.Generics.Auto t)) (Transformation.AG.Semantics (Transformation.AG.Generics.Auto t)))) => Transformation.Full.Functor (Transformation.AG.Generics.Auto t) g -- | This module exports the templates for automatic instance deriving of -- Transformation.Shallow type classes. The most common way to use -- it would be -- --
--   import qualified Transformation.Shallow.TH
--   data MyDataType f' f = ...
--   $(Transformation.Shallow.TH.deriveFunctor ''MyDataType)
--   
module Transformation.Shallow.TH deriveAll :: Name -> Q [Dec] deriveFunctor :: Name -> Q [Dec] deriveFoldable :: Name -> Q [Dec] deriveTraversable :: Name -> Q [Dec]