-- 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.1
-- | 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:
--
--
-- - an instance of the base class Transformation declares the
-- two functors being mapped, much like a function type signature,
-- - while the actual mapping of values is performed by an arbitrary
-- number of instances of the method $, a bit like multiple
-- equation clauses that make up a single function definition.
--
--
-- 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 family Domain t :: Type -> Type;
type family 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
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)
-- | 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))
-- | 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)
-- | 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 g1 g2 (p :: * -> *) (q :: * -> *)
Pair :: q (g1 p p) -> q (g2 p p) -> Product g1 g2 (p :: * -> *) (q :: * -> *)
[fst] :: Product g1 g2 (p :: * -> *) (q :: * -> *) -> q (g1 p p)
[snd] :: Product g1 g2 (p :: * -> *) (q :: * -> *) -> q (g2 p p)
-- | Alphabetical synonym for <$>
fmap :: Functor t g => t -> g (Domain t) (Domain t) -> g (Codomain t) (Codomain t)
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 Rank2.Functor (Transformation.Deep.Product g1 g2 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]
-- | 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 :: * -> *) 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
-- | 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 sem), g sem (Synthesized t)) -> (Synthesized t (g sem sem), 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)
-- | 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 <$>
fullMapDefault :: (p ~ Domain t, q ~ Semantics t, q ~ Codomain t, x ~ g q q, Apply (g q), Functor t g, Attribution t g p p) => (forall a. p a -> a) -> t -> p (g p p) -> q (g q q)
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)
-- | 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
-- | 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 (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)
-- | 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:
--
--
-- - If an attribution rule always merely copies the inherited
-- attributes to the children's inherited attributes of the same name,
-- the rule can be left out by wrapping the transformation into an
-- Auto constructor and deriving the Generic instance of
-- the inherited attributes.
-- - A synthesized attribute whose value is a fold of all same-named
-- attributes of the children can be wrapped in the Folded
-- constructor and calculated automatically.
-- - A synthesized attribute that is a copy of the current node but
-- with every child taken from the same-named synthesized child attribute
-- can be wrapped in the Mapped constructor and calculated
-- automatically.
-- - If the attribute additionally carries an applicative effect, the
-- Mapped wrapper can be replaced by Traversed.
--
module Transformation.AG.Generics
-- | Transformation wrapper that allows automatic inference of attribute
-- rules.
newtype Auto t
Auto :: t -> Auto 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, dom ~ Domain t) => Revelation t dom
-- | Extract the value from the transformation domain
reveal :: Revelation t dom => t -> dom 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 shallow, 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 shallow, 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.Transformation t, Transformation.Domain t GHC.Types.~ Data.Functor.Identity.Identity) => Transformation.AG.Generics.Revelation t Data.Functor.Identity.Identity
instance (Transformation.Transformation t, Transformation.Domain t GHC.Types.~ (,) a) => Transformation.AG.Generics.Revelation t ((,) a)
-- | 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]