P      ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~        !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~                                                                 !!!! !!!""#"$"%"&"'"(")"*"+,-./#0$1$2$3$4$5$6$7$8$9$:$;$<$=$>%?%@%A%B%C&D&E&F&G&H&I&J&K&L&M&N&O&P&Q&R&S&T'U'V'W'X'Y'Z'['\']'^'_'`'a'b'c'd'e'f'g'h'i'j'k'l'm'n'o'p'q'r's't'u'v'w'x'y'z'{'|'}'~''''''''''''''''''''''((((((())))****+++++,,,,,,,,,,,,,,----------------------------------------------------------------------....... . . . . ................... .!.".#.$.%.&.'.(.).*.+.,.-.../.0.1.2.3.4.5.6.7.8.9.:.;.<.=.>.?.@.A.B.C.D/E/F/G/H/I/J/K0L0M0N0O0P0Q0R0S0TUVWXYZ1[2\3]3^3_3`3a3b3c3d3e3f3g3h3i4j4k5l5m5n5o5p5q5r5s5t5u5v5w5x5y6z6{6|6}6~666677777777777777777777788888888888888888888888888888888888888888888899999nnon-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk> ;Abstract notion of a variable (the constructor is hidden).  1Monad for generating fresh (abstract) variables.  Equality on variables. Ordering of variables. Printing of variables. Change the type of a variable. Generate a fresh variable. 2Evaluate a computation that uses fresh variables.    non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>The empty data type " is used to emulate parametricity  ("poor mans parametricity"). non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>;Abstract notion of a variable (the constructor is hidden). 1Monad for generating fresh (abstract) variables. Generate a fresh variable. 2Evaluate a computation that uses fresh variables. non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>The empty data type " is used to emulate parametricity  ("poor mans parametricity"). non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>IThis class represents difunctors, i.e. binary type constructors that are K contravariant in the first argument and covariant in the second argument. 'The canonical example of a difunctor. non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>KDifunctors representing data structures that can be traversed from left to  right. Functions of the type Any -> Maybe a! can be turned into functions of  type Maybe (Any -> a). The empty type Any ensures that the function + is parametric in the input, and hence the Maybe monad can be pulled out.  non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk> &Remove annotations from a signature. !AThis class defines how to distribute an annotation over a sum of  signatures. "(Inject an annotation over a signature. #)Project an annotation from a signature. $8This data type adds a constant product to a signature. %&+Formal product of signatures (difunctors). '(LSignature containment relation for automatic injections. The left-hand must L be an atomic signature, where as the right-hand side must have a list-like  structure. Examples include f :< : f :+: g and g :<: f :+: (g :+: h),  non-examples include  f :+: g :<: f :+: (g :+: h) and  f :<: (f :+: g) :+: h. )*+'Formal sum of signatures (difunctors). ,-./ !"#$%&'()*+,-./+-,()*&'./$%!"#  !"#"#$%%&''()*)*+-,,-./ non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>01@A term is a context with no holes, where all occurrences of the @ contravariant parameter is fully parametric. Parametricity is "emulated"  using the empty type Any, e.g. a function of type  Any -> T[Any] is  equivalent with forall b. b -> T[b]*, but the former avoids the impredicative Q typing extension, and works also in the cases where the codomain type is not a  type constructor, e.g. Any -> (Any,Any). 23AA context may contain holes, but must be parametric in the bound  parameters. Parametricity is "emulated" using the empty type Any , e.g. a  function of type  Any -> T[Any] is equivalent with forall b. b -> T[b], N but the former avoids the impredicative typing extension, and works also in D the cases where the codomain type is not a type constructor, e.g.  Any -> (Any,Any). 4Phantom type used to define 91. 5Phantom type used to define 3. 6HThis data type represents contexts over a signature. Contexts are terms H containing zero or more holes, and zero or more parameters. The first L parameter is a phantom type indicating whether the context has holes. The E second paramater is the signature of the context, in the form of a  Data.Comp.Param.Difunctor1. The third parameter is the type of parameters, 2 and the fourth parameter is the type of holes. 789:.Convert a difunctorial value into a context. ;Cast a "pseudo-parametric"* context over a signature to a parametric 0 context over the same signature. The usage of  is safe, because  the empty type ; witnesses that all uses of the contravariant argument are  parametric. <=CThis function converts a constant to a term. This assumes that the D argument is indeed a constant, i.e. does not have a value for the ! argument type of the difunctor f. >This is an instance of  for 6. ?This is an instance of dimamM for 6. @This is an instance of  for 6. 0123456789:;<=>?@6987541230:;<=>@?0123456987789:;<=>?@ non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>NAAThis type represents a generalised cv-coalgebra over a difunctor f and  carrier a. B=This type represents a monadic cv-coalgebra over a difunctor f and carrier  a. C5This type represents a cv-coalgebra over a difunctor f and carrier a.  The list of (a,b)1s represent the parameters that may occur in the O constructed value. The first component represents the seed of the parameter, E and the second component is the (polymorphic) parameter itself. If f is 0 itself a binder, then the parameters bound by f can be passed to the C covariant argument, thereby making them available to sub terms. D9This type represents a monadic cv-algebra over a functor f and carrier  a. E3This type represents a cv-algebra over a difunctor f and carrier a. F:This type represents a monadic r-coalgebra over a functor f and carrier  a. G5This type represents an r-coalgebra over a difunctor f and carrier a. H:This type represents a monadic r-algebra over a difunctor f and carrier  a. I3This type represents an r-algebra over a difunctor f and carrier a. J:This type represents a monadic coalgebra over a difunctor f and carrier  a. K2This type represents a coalgebra over a difunctor f and carrier a. The  list of (a,b)=s represent the parameters that may occur in the constructed C value. The first component represents the seed of the parameter, E and the second component is the (polymorphic) parameter itself. If f is 0 itself a binder, then the parameters bound by f can be passed to the C covariant argument, thereby making them available to sub terms. LCThis type represents a monadic term homomorphism. It is similar to  '2HomMD but has monadic values also in the domain. M3This type represents a monadic term homomorphism. NDThis type represents a monadic signature function. It is similar to  '5SigFunMD but has monadic values also in the domain. 2This type represents a monadic context function. O2This type represents a monadic context function. P4This type represents a monadic signature function. Q+This type represents a term homomorphism. R,This type represents a signature function. S*This type represents a context function. T9This type represents a monadic algebra. It is similar to U but  the return type is monadic. U1This type represents an algebra over a difunctor f and carrier a. V+Construct a catamorphism for contexts over f with holes of type b, from  the given algebra. W2Construct a catamorphism from the given algebra. XA generalisation of W from terms over f to contexts over f, where 3 the holes have the type of the algebra carrier. Y=This function applies a whole context into another context. ZBConvert a monadic algebra into an ordinary algebra with a monadic  carrier. [3Construct a monadic catamorphism for contexts over f with holes of type  b#, from the given monadic algebra. \BConstruct a monadic catamorphism from the given monadic algebra. ]A generalisation of \ from terms over f to contexts over f, where ; the holes have the type of the monadic algebra carrier. ^/Apply a term homomorphism recursively to a term/ context. _/Apply a term homomorphism recursively to a term/ context. `!Compose two term homomorphisms. aCCompose an algebra with a term homomorphism to get a new algebra. bcBThis function applies a signature function to the given context. d8This function applies a signature function to the given * context. This is a top-bottom variant of c. e1This function composes two signature functions. fFThis function composes a term homomorphism and a signature function. gFThis function composes a term homomorphism and a signature function. hHLifts the given signature function to the canonical term homomorphism. iMLift the given signature function to a monadic signature function. Note that O term homomorphisms are instances of signature functions. Hence this function ' also applies to term homomorphisms. jCLift the given signature function to a monadic term homomorphism. k3Apply a monadic term homomorphism recursively to a  term/+context. The monad is sequenced bottom-up. l3Apply a monadic term homomorphism recursively to a  term/)context. The monad is sequence top-down. mBThis function constructs the unique monadic homomorphism from the 3 initial term algebra to the given term algebra. nJThis function applies a monadic signature function to the given context. o@This function applies a monadic signature function to the given  context. This is a 'top-down variant of n. pBThis function applies a signature function to the given context. q)Compose two monadic term homomorphisms. )Compose two monadic term homomorphisms. )Compose two monadic term homomorphisms. )Compose two monadic term homomorphisms. r)Compose two monadic term homomorphisms. )Compose two monadic term homomorphisms. sHCompose a monadic algebra with a monadic term homomorphism to get a new  monadic algebra. tHCompose a monadic algebra with a term homomorphism to get a new monadic  algebra. uICompose a monadic algebra with a monadic signature function to get a new  monadic algebra. vICompose a monadic algebra with a signature function to get a new monadic  algebra. w9This function composes two monadic signature functions. x4Construct an anamorphism from the given coalgebra. yCConstruct a monadic anamorphism from the given monadic coalgebra. z4Construct a paramorphism from the given r-algebra. {DConstruct a monadic paramorphism from the given monadic r-algebra. |6Construct an apomorphism from the given r-coalgebra. }EConstruct a monadic apomorphism from the given monadic r-coalgebra. This function applies # at the tip of the term. ~6Construct a histomorphism from the given cv-algebra. FConstruct a monadic histomorphism from the given monadic cv-algebra. 7Construct a futumorphism from the given cv-coalgebra. GConstruct a monadic futumorphism from the given monadic cv-coalgebra. CConstruct a futumorphism from the given generalised cv-coalgebra. FThis function applies a signature function after a term homomorphism. BABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~BUVWXYTZ[\]SRQ^_`cdefghabOPMNLikljmnopqwruvstKxJyIzH{G|F}E~DCABBABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~:non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>;non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk> non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>@KProject the outermost layer of a term to a sub signature. If the signature  g is compound of n atomic signatures, use projectn instead. Tries to coerce a termcontext to a term!context over a sub-signature. If  the signature g is compound of n atomic signatures, use   deepProjectn instead. MInject a term where the outermost layer is a sub signature. If the signature  g is compound of n atomic signatures, use injectn instead. KInject a term over a sub signature to a term over larger signature. If the  signature g is compound of n atomic signatures, use  deepInjectn  instead. =This function injects a whole context into another context. 5This function lifts the given functor to a context. D()*+D()*+@ non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>LTransform a function with a domain constructed from a functor to a function I with a domain constructed with the same functor, but with an additional  annotation. LTransform a function with a domain constructed from a functor to a function J with a domain constructed with the same functor, but with an additional  annotation. DStrip the annotations from a term over a functor with annotations. )Lift a term homomorphism over signatures f and g to a term homomorphism ; over the same signatures, but extended with annotations. 1Lift a monadic term homomorphism over signatures f and g to a monadic N term homomorphism over the same signatures, but extended with annotations. 5Annotate each node of a term with a constant value.  !"#$%&'$%&'!"# non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk> Signature equality. An instance EqD f gives rise to an instance   Eq (Term f),. The equality test is performed inside the  monad for ! generating fresh identifiers. IEquality on parametric values. The equality test is performed inside the  ) monad for generating fresh identifiers. Equality on terms. From an  difunctor an - instance of the corresponding term type can  be derived.  is propagated through sums. non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk> Signature ordering. An instance OrdD f gives rise to an instance   Ord (Term f). Ordering of parametric values. Ordering of terms. From an  difunctor an ) instance of the corresponding term type  can be derived.  is propagated through sums. <non-portable (GHC Extensions) experimental:Patrick Bahr <paba@diku.dk>, Tom Hvitved <hvitved@diku.dk> !"#$%&'()*+0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>@This data type denotes the composition of two functor families. AThis class represents higher-order functors (Johann, Ghani, POPL  '<08) which are endofunctors on the category of endofunctors. A higher-order functor f$ also maps a natural transformation  g :-> h to a natural transformation  f g :-> f h #This type represents co-cones from f to a. f :=> a is  isomorphic to f :-> K a .This type represents natural transformations. #The parametrised constant functor. The identity Functor. non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk> *Higher-order functors that can be folded. Minimal complete definition:  or . non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>>Map each element of a structure to a monadic action, evaluate < these actions from left to right, and collect the results. ;Alternative type in terms of natural transformations using  functor composition :.:: :hmapM :: Monad m => (a :-> m :.: b) -> t a :-> m :.: (t b)non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>/This class represents higher-order difunctors. 6This type represents monadic natural transformations. .This type represents natural transformations. #The parametrised constant functor. The identity functor. CA higher-order difunctor gives rise to a higher-order functor when 4 restricted to a particular contravariant argument.  non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>LHDifunctors representing data structures that can be traversed from left to  right. If a higher-order difunctor is  for a given contravariant  argument a , then it is  for all s m with the same  a. non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>@A term is a context with no holes, where all occurrences of the @ contravariant parameter is fully parametric. Parametricity is "emulated"  using the empty functor Any, e.g. a function of type  Any :-> T[Any] is  equivalent with forall b. b :-> T[b], but the former avoids the H impredicative typing extension, and works also in the cases where the 0 codomain type is not a type constructor, e.g. Any i -> (Any i,Any i). AA context may contain holes, but must be parametric in the bound  parameters. Parametricity is "emulated" using the empty functor Any,  e.g. a function of type  Any :-> T[Any] is equivalent with  forall b. b :-> T[b]1, but the former avoids the impredicative typing O extension, and works also in the cases where the codomain type is not a type  constructor, e.g. Any i -> (Any i,Any i). Phantom type used to define . Phantom type used to define . HThis data type represents contexts over a signature. Contexts are terms H containing zero or more holes, and zero or more parameters. The first L parameter is a phantom type indicating whether the context has holes. The E second paramater is the signature of the context, in the form of a  Data.Comp.MultiParam.HDifunctor%. The third parameter is the type of G parameters, the fourth parameter is the type of holes, and the fifth  parameter is the GADT type. .Convert a difunctorial value into a context.  Cast a "pseudo-parametric"* context over a signature to a parametric 0 context over the same signature. The usage of  is safe, because  the empty functor 7 witnesses that all uses of the contravariant argument  are parametric.   CThis function converts a constant to a term. This assumes that the D argument is indeed a constant, i.e. does not have a value for the . argument type of the higher-order difunctor f.  This is an instance of  for .  This is an instance of  for .                non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>&3This type represents a monadic term homomorphism. 2This type represents a monadic context function. 2This type represents a monadic context function. 4This type represents a monadic signature function. +This type represents a term homomorphism. *This type represents a context function. ,This type represents a signature function. LThis type represents a monadic algebra, but where the covariant argument is  also a monadic computation. 9This type represents a monadic algebra. It is similar to  but  the return type is monadic. 1This type represents an algebra over a difunctor f and carrier a. +Construct a catamorphism for contexts over f with holes of type b, from  the given algebra. 2Construct a catamorphism from the given algebra. A generalisation of  from terms over f to contexts over f, where 3 the holes have the type of the algebra carrier. =This function applies a whole context into another context. 3Construct a monadic catamorphism for contexts over f with holes of type  b#, from the given monadic algebra. BConstruct a monadic catamorphism from the given monadic algebra. 3Construct a monadic catamorphism for contexts over f with holes of type  b#, from the given monadic algebra. BConstruct a monadic catamorphism from the given monadic algebra. /Apply a term homomorphism recursively to a term/ context.  /Apply a term homomorphism recursively to a term/context. This is  a top-down variant of . !!Compose two term homomorphisms. "CCompose an algebra with a term homomorphism to get a new algebra. #BThis function applies a signature function to the given context. $BThis function applies a signature function to the given context. %1This function composes two signature functions. &HLifts the given signature function to the canonical term homomorphism. 'MLift the given signature function to a monadic signature function. Note that O term homomorphisms are instances of signature functions. Hence this function ' also applies to term homomorphisms. (JLift the give monadic signature function to a monadic term homomorphism. )CLift the given signature function to a monadic term homomorphism. *7Apply a monadic term homomorphism recursively to a term/ context. +3Apply a monadic term homomorphism recursively to a  term/'context. This is a top-down variant of *. ,JThis function applies a monadic signature function to the given context. -@This function applies a monadic signature function to the given ( context. This is a top-down variant of ,. .)Compose two monadic term homomorphisms. /HCompose a monadic algebra with a monadic term homomorphism to get a new  monadic algebra. 0HCompose a monadic algebra with a term homomorphism to get a new monadic  algebra. 19This function composes two monadic signature functions. '  !"#$%&'()*+,-./01'  !#$%&"'(*+),-.1/0$ !"#$%&'()*+,-./01non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk> 22A (higher-order) term is a context with no holes. 3#Phantom type family used to define 92. 4A context might contain holes. 5!Phantom type that signals that a 7 does not contain holes. 6!Phantom type that signals that a 7 might contain holes. 7BThis data type represents contexts over a signature. Contexts are B terms containing zero or more holes. The first type parameter is ) supposed to be one of the phantom types 86 and 5. The = second parameter is the signature of the context. The third B parameter is the type family of the holes. The last parameter is  the index/label. 89:;?This function converts a constant to a term. This assumes that C the argument is indeed a constant, i.e. does not have a value for % the argument type of the functor f. <<This function unravels the given term at the topmost layer. =>DCast a term over a signature to a context over the same signature. 23456789:;<=> 79865432:;<>= 2345679889:;<=>=non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>? An instance a :< b means that a is a component of b. a  can be extracted from b via the method ex. @A?@A?@A@Anon-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk> B(This type is used for applying a DDTAs. CD<Instances of this class provide a generalisation of the zip  function on the list functor. EFGThe  <:> % operator is an infix version of the F  constructor. HIJ BCDEFGHIJ DBCHIJEFG BCCDEFFGHIJnon-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>?@A?@A>non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>  This is the Q-lifted version of 'abstractNewtypeQ. This function abstracts away newtype! declaration, it turns them into  data declarations. MThis function provides the name and the arity of the given data constructor. Same as normalCon' but expands type synonyms. MThis function provides the name and the arity of the given data constructor. 8This function returns the name of a bound type variable GThis function provides a list (of the given length) of new names based  on the given string. KGHelper function for generating a list of instances for a list of named 7 signatures. For example, in order to derive instances  and  ShowF for a signature Exp+, use derive as follows (requires Template  Haskell): , $(derive [makeFunctor, makeShowF] [''Exp]) K K?non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>L Signature printing. An instance ShowF f gives rise to an instance   Show (Term f). M NDerive an instance of L0 for a type constructor of any first-order kind ! taking at least one argument. LMNLMMN@non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>O Signature equality. An instance EqF f gives rise to an instance   Eq (Term f). PQDerive an instance of O0 for a type constructor of any first-order kind ! taking at least one argument. OPQOPPQAnon-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>R Signature ordering. An instance OrdF f gives rise to an instance   Ord (Term f). S TDerive an instance of R0 for a type constructor of any first-order kind ! taking at least one argument. RSTRSSTBnon-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>UDerive an instance of + for a type constructor of any first-order & kind taking at least one argument. UUCnon-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>VDerive an instance of  for a type constructor of any 2 first-order kind taking at least one argument. VVDnon-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk> W#Signature arbitration. An instance  ArbitraryF f gives rise to an instance  Arbitrary (Term f). XYZ[Derive an instance of  for a type constructor. \Derive an instance of W for a type constructor of any F first-order kind taking at least one argument. It is necessary that E all types that are used by the data type definition are themselves  instances of .  4This function generates a declaration of the method  for the given  list of constructors using  .  QThis function generates a declaration of a generator having the given name using 5 the given constructors, i.e., something like this:    <name> :: Gen <type>  <name> = ... where <type>J is the type of the given constructors. If the constructors do not belong ^ to the same type this function fails. The generated function will generate only elements of ` this type using the given constructors. All argument types of these constructors are supposed  to be instances of .  5This function generates a declaration for the method Z using the given constructors. < The constructors are supposed to belong to the same type. WXYZ[\WXYZXYZ[\Enon-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>]#Signature normal form. An instance  NFDataF f gives rise to an instance  NFData (Term f). ^_Derive an instance of ]+ for a type constructor of any first-order & kind taking at least one argument. ]^_]^^_Fnon-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>` Signature equality. An instance HEqF f gives rise to an instance   KEq (HTerm f). abcdDerive an instance of `, for a type constructor of any higher-order ' kind taking at least two arguments. `abcd`aabccdGnon-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>eDerive an instance of , for a type constructor of any higher-order ' kind taking at least two arguments. eeHnon-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>fDerive an instance of , for a type constructor of any higher-order ' kind taking at least two arguments. ffInon-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>gDerive an instance of  for a type constructor of any 4 higher-order kind taking at least two arguments. ggJnon-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>hDerive an instance of * for a type constructor of any parametric ' kind taking at least two arguments. hhKnon-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>iDerive an instance of * for a type constructor of any parametric ' kind taking at least two arguments. iiLnon-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>j Signature printing. An instance ShowD f gives rise to an instance   Show (Term f). klPrinting of parametric values. mnDerive an instance of j* for a type constructor of any parametric ' kind taking at least two arguments. jklmnjkklmmnMnon-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>oDerive an instance of * for a type constructor of any parametric ' kind taking at least two arguments. ooNnon-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>pDerive an instance of  Traversable for a type constructor of any 2 first-order kind taking at least one argument. ppOnon-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>qFDerive smart constructors for a difunctor. The smart constructors are - similar to the ordinary constructors, but a 'inject . dimap Place id' is  automatically inserted. qqPnon-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>rFDerive smart constructors with annotations for a difunctor. The smart > constructors are similar to the ordinary constructors, but a  'injectA . dimap Place id' is automatically inserted. rrQnon-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>sJGiven the name of a type class, where the first parameter is a difunctor, * lift it to sums of difunctors. Example: class ShowD f where ... is lifted  as 9instance (ShowD f, ShowD g) => ShowD (f :+: g) where ... . tKUtility function to case on a difunctor sum, without exposing the internal  representation of sums. ststnon-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>KhijklmnopqrstKhilmjknopqrstRnon-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>Printing of terms. From an j difunctor an j) instance of the corresponding term type  can be derived. jklmlmjknon-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>u"The desugaring term homomorphism. vwxDesugar a term. y$Lift desugaring to annotated terms. Default desugaring instance. uvwxyuvwxyuvwvwxySnon-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>z Signature printing. An instance ShowHD f gives rise to an instance  Show (Term f i). {|Printing of parametric values. }~Derive an instance of z* for a type constructor of any parametric ) kind taking at least three arguments. z{|}~z{{|}}~Tnon-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>Derive an instance of * for a type constructor of any parametric ) kind taking at least three arguments. non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>&Remove annotations from a signature. AThis class defines how to distribute an annotation over a sum of  signatures. (Inject an annotation over a signature. )Project an annotation from a signature. EThis data type adds a constant product (annotation) to a signature. )Formal product of signatures (functors). LSignature containment relation for automatic injections. The left-hand must L be an atomic signature, where as the right-hand side must have a list-like  structure. Examples include f :< : f :+: g and g :<: f :+: (g :+: h),  non-examples include  f :+: g :<: f :+: (g :+: h) and  f :<: (f :+: g) :+: h. %Formal sum of signatures (functors). non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>36This type represents monadic cv-coalgebras over monad m and  functor f, and with domain a. 0This type represents cv-coalgebras over functor f and with domain  a. 5This type represents monadic r-coalgebras over monad m and  functor f with domain a. /This type represents r-coalgebras over functor f and with  domain a. 3This type represents monadic r-algebras over monad m and  functor f and with domain a. -This type represents r-algebras over functor f and with domain  a. ,This type represents monadic term algebras. /This type represents monadic context function. 2This type represents monadic signature functions. )This type represents term homomorphisms. 'This type represents context function. ?This type represents uniform signature function specification. 9This type represents a monadic algebra. It is similar to  ! but the return type is monadic. !This type represents multisorted f-algebras with a family e  of carriers. +Construct a catamorphism for contexts over f with holes of type  b, from the given algebra. 1Construct a catamorphism from the given algebra. A generalisation of  from terms over f to contexts over  f8, where the holes have the type of the algebra carrier. <This function applies a whole context into another context. ?This function lifts a many-sorted algebra to a monadic domain. 3Construct a monadic catamorphism for contexts over f with holes  of type b", from the given monadic algebra. This is a monadic version of . 7This function applies the given term homomorphism to a  term/ context. 7This function applies the given term homomorphism to a  term/)context. This is the top-down variant of . *This function composes two term algebras. 7This function composes a term algebra with an algebra. 8This function applies a signature function to the given * context. This is the top-down variant of . AThis function applies a signature function to the given context. 0This function composes two signature functions. GLifts the given signature function to the canonical term homomorphism. >This function lifts the given signature function to a monadic > signature function. Note that term algebras are instances of ? signature functions. Hence this function also applies to term  algebras. =This function lifts the give monadic signature function to a  monadic term algebra. >This function lifts the given signature function to a monadic  term algebra. AThis function applies the given monadic term homomorphism to the  given term/ context. AThis function applies the given monadic term homomorphism to the  given term/'context. This is a top-down variant of . BThis function applies the given monadic signature function to the  given context. BThis function applies the given monadic signature function to the . given context. This is a top-down variant of . 2This function composes two monadic term algebras. FThis function composes a monadic term algebra with a monadic algebra =This function composes a monadic term algebra with a monadic  algebra. :This function composes two monadic signature functions. @This function unfolds the given value to a term using the given 6unravelling function. This is the unique homomorphism  a -> Term f !from the given coalgebra of type a -> f a to the final coalgebra Term f. @This function unfolds the given value to a term using the given ? monadic unravelling function. This is the unique homomorphism a ->  Term f" from the given coalgebra of type a -> f a to the final  coalgebra Term f. AThis function constructs a paramorphism from the given r-algebra ?This function constructs a monadic paramorphism from the given  monadic r-algebra 7This function constructs an apomorphism from the given  r-coalgebra. >This function constructs a monadic apomorphism from the given  monadic r-coalgebra. @This function constructs the unique futumorphism from the given # cv-coalgebra to the term algebra. BThis function constructs the unique monadic futumorphism from the 1 given monadic cv-coalgebra to the term algebra. 333Unon-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk> Signature printing. An instance HShowF f gives rise to an instance  KShow (HTerm f). Derive an instance of , for a type constructor of any higher-order ' kind taking at least two arguments. non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>AThis class defines how to distribute an annotation over a sum of  signatures. 6This function injects an annotation over a signature. ,This data type adds a constant product to a @ signature. Alternatively, this could have also been defined as   data (f :&: a) (g :: * -> *) e = f g e :&: a e.This is too general, however, for example for  productHHom. The subsumption relation. Data type defining coproducts. Vnon-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>Wnon-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk> non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>AKProject the outermost layer of a term to a sub signature. If the signature  g is compound of n atomic signatures, use projectn instead. Tries to coerce a termcontext to a term!context over a sub-signature. If  the signature g is compound of n atomic signatures, use   deepProjectn instead. MInject a term where the outermost layer is a sub signature. If the signature  g is compound of n atomic signatures, use injectn instead.    KInject a term over a sub signature to a term over larger signature. If the  signature g is compound of n atomic signatures, use  deepInjectn  instead.   <This function injects a whole context into another context. 4This function lifts the given functor to a context. 7This function applies the given context with hole type a to a  family f) of contexts (possibly terms) indexed by a . That is,  each hole h is replaced by the context f h. E     E     A     !non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>>This function transforms a function with a domain constructed A from a functor to a function with a domain constructed with the 1 same functor but with an additional annotation. AThis function annotates each sub term of the given term with the  given value (of type a). >This function transforms a function with a domain constructed A from a functor to a function with a domain constructed with the 1 same functor but with an additional annotation. 8This function strips the annotations from a term over a functor with annotations.   !  ! "non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk> ":This function returns a list of all subterms of the given + term. This function is similar to Uniplate's universe function. #?This function returns a list of all subterms of the given term 1 that are constructed from a particular functor. $>This function transforms every subterm according to the given = function in a bottom-up manner. This function is similar to  Uniplate's  transform function. %Monadic version of $. &'();This function computes the generic size of the given term, - i.e. the its number of subterm occurrences. *<This function computes the generic depth of the given term. "#$%&'()* "#$%&'()* "#$%&'()*Xnon-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>+JDerive smart constructors for a type constructor of any higher-order kind J taking at least two arguments. The smart constructors are similar to the  ordinary constructors, but an  is automatically inserted. ++Ynon-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>,FDerive smart constructors with products for a type constructor of any L parametric kind taking at least two arguments. The smart constructors are / similar to the ordinary constructors, but an  is automatically  inserted. ,,Znon-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>-LGiven the name of a type class, where the first parameter is a higher-order 5 functor, lift it to sums of higher-order. Example: class HShowF f where ...  is lifted as <instance (HShowF f, HShowF g) => HShowF (f :+: g) where ... . .MUtility function to case on a higher-order functor sum, without exposing the $ internal representation of sums. -.-.non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>K`abcdefg+,-.K`abcdefg+,-.#non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>/4This function implements equality of values of type f a modulo the equality of a4 itself. If two functorial values are equal in this sense, eqMod returns a " value containing a list of pairs =consisting of corresponding components of the two functorial  values. From an EqF functor an  instance of the corresponding  term type can be derived. EqF is propagated through sums. `abc/`abc//[non-portable (GHC Extensions) experimental:Patrick Bahr <paba@diku.dk>, Tom Hvitved <hvitved@diku.dk>23456789:;<=>`abc      !"#$%&'()*/\non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>$non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>0GThis multiparameter class defines functors with variables. An instance   HasVar f v denotes that values over f% might contain and bind variables of  type v. 12345@This function substitutes variables in a context according to a ,partial mapping from variables to contexts. 67 8DThis function checks whether a variable is contained in a context. !9FThis function computes the list of variables occurring in a context. ":EThis function computes the set of variables occurring in a context. ;EThis function computes the set of variables occurring in a context. <=)This function composes two substitutions s1 and s2 . That is, Dapplying the resulting substitution is equivalent to first applying s2 and then s1. 0123456789:;<=01254378:9;6<=012123456789:;<=%non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>>"The desugaring term homomorphism. ?@ADesugar a term. B$Lift desugaring to annotated terms. #Default desugaring instance. >?@AB>?@AB>?@?@AB&non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>CD&Remove annotations from a signature. EAThis class defines how to distribute an annotation over a sum of  signatures. F(Inject an annotation over a signature. G)Project an annotation from a signature. H8This data type adds a constant product to a signature. IJ8Formal product of signatures (higher-order difunctors). KLLSignature containment relation for automatic injections. The left-hand must L be an atomic signature, where as the right-hand side must have a list-like  structure. Examples include f :< : f :+: g and g :<: f :+: (g :+: h),  non-examples include  f :+: g :<: f :+: (g :+: h) and  f :<: (f :+: g) :+: h. MNO'Formal sum of signatures (difunctors). PQRSCDEFGHIJKLMNOPQRSOQPLMNJKRSHIEFGCDCDDEFGFGHIIJKKLMNMNOQPPQRS]non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>$%&$%&$%&^non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>'()'()'()'non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>@TUVWXYZ[\]KProject the outermost layer of a term to a sub signature. If the signature  g is compound of n atomic signatures, use projectn instead. ^_`abcdefgTries to coerce a termcontext to a term!context over a sub-signature. If  the signature g is compound of n atomic signatures, use   deepProjectn instead. hijklmnopqrstuvwxyzMInject a term where the outermost layer is a sub signature. If the signature  g is compound of n atomic signatures, use injectn instead. {|}~KInject a term over a sub signature to a term over larger signature. If the  signature g is compound of n atomic signatures, use  deepInjectn  instead. =This function injects a whole context into another context. 5This function lifts the given functor to a context. DLMNOTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~DLMNOTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~@TUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~(non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>MTransform a function with a domain constructed from a higher-order difunctor P to a function with a domain constructed with the same higher-order difunctor, & but with an additional annotation. MTransform a function with a domain constructed from a higher-order difunctor P to a function with a domain constructed with the same higher-order difunctor, & but with an additional annotation. EStrip the annotations from a term over a higher-order difunctor with  annotations. )Lift a term homomorphism over signatures f and g to a term homomorphism ; over the same signatures, but extended with annotations. 1Lift a monadic term homomorphism over signatures f and g to a monadic N term homomorphism over the same signatures, but extended with annotations. 5Annotate each node of a term with a constant value. CDEFGHIJKHIJKEFGCD)non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk> Signature equality. An instance EqHD f gives rise to an instance   Eq (Term f i),. The equality test is performed inside the   monad for ! generating fresh identifiers. IEquality on parametric values. The equality test is performed inside the   ) monad for generating fresh identifiers. *Equality on terms. +From an  difunctor an - instance of the corresponding term type can  be derived. , is propagated through sums. _non-portable (GHC Extensions) experimental:Patrick Bahr <paba@diku.dk>, Tom Hvitved <hvitved@diku.dk>       !"#$%&'()*+,-./01CDEFGHIJKLMNOTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~`non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>Derive an instance of * for a type constructor of any parametric ) kind taking at least three arguments. anon-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>BDerive smart constructors for a higher-order difunctor. The smart > constructors are similar to the ordinary constructors, but a  'inject . hdimap Place id' is automatically inserted. *non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk> Signature ordering. An instance OrdHD f gives rise to an instance   Ord (Term f). Ordering of parametric values. -Ordering of terms. .From an  difunctor an ) instance of the corresponding term type  can be derived. / is propagated through sums. bnon-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>0Derive an instance of * for a type constructor of any parametric ) kind taking at least three arguments. cnon-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>MDerive smart constructors with annotations for a higher-order difunctor. The D smart constructors are similar to the ordinary constructors, but a  'injectA . hdimap Place id' is automatically inserted. dnon-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>LGiven the name of a type class, where the first parameter is a higher-order B difunctor, lift it to sums of higher-order difunctors. Example:  class ShowHD f where ... is lifted as  <instance (ShowHD f, ShowHD g) => ShowHD (f :+: g) where ... . KUtility function to case on a higher-order difunctor sum, without exposing ( the internal representation of sums. non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>Kfgz{|}~K|}z{~fgenon-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>1Printing of terms. 2From an z higher-order difunctor an z instance of the + corresponding term type can be derived. z{|}|}z{+non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>"The desugaring term homomorphism. Desugar a term. $Lift desugaring to annotated terms. 3Default desugaring instance. ,non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>;Polymorphic definition of a term. This formulation is more  natural than 1, it leads to impredicative types in some cases,  though. %A term is a context with no holes. Phantom type used to define . !Phantom type that signals that a  does not contain holes. !Phantom type that signals that a  might contain holes. BThis data type represents contexts over a signature. Contexts are Aterms containing zero or more holes. The first type parameter is (supposed to be one of the phantom types  and . The Fsecond parameter is the signature of the context. The third parameter is the type of the holes. CThis function converts a constant to a term. This assumes that the Bargument is indeed a constant, i.e. does not have a value for the argument type of the functor f. -Convert a functorial value into a context. DCast a term over a signature to a context over the same signature. >This function unravels the given term at the topmost layer. -non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>P?This type represents a generalised cv-coalgebra over a functor f and  carrier a. ;This type represents a monadic cv-coalgebra over a functor f and carrier  a. 3This type represents a cv-coalgebra over a functor f and carrier a. 9This type represents a monadic cv-algebra over a functor f and carrier  a. 1This type represents a cv-algebra over a functor f and carrier a. :This type represents a monadic r-coalgebra over a functor f and carrier  a. 3This type represents an r-coalgebra over a functor f and carrier a. 8This type represents a monadic r-algebra over a functor f and carrier  a. 1This type represents an r-algebra over a functor f and carrier a. 8This type represents a monadic coalgebra over a functor f and carrier  a. 0This type represents a coalgebra over a functor f and carrier a. CThis type represents a monadic term homomorphism. It is similar to - but has monadic values also in the domain. 4This type represents a monadic term homomorphism. BThis type represents a monadic signature function. It is similar to - but has monadic values also in the domain. 4This type represents a monadic signature function. 1This type represents a monadic context function. +This type represents a term homomorphism. +This type represents a signature function. *This type represents a context function. 9This type represents a monadic algebra. It is similar to  but the return type is monadic. /This type represents an algebra over a functor f and carrier a. +Construct a catamorphism for contexts over f with holes of type a, from  the given algebra. 2Construct a catamorphism from the given algebra. A generalisation of  from terms over f to contexts over f, where 3 the holes have the type of the algebra carrier. =This function applies a whole context into another context. BConvert a monadic algebra into an ordinary algebra with a monadic  carrier. 3Construct a monadic catamorphism for contexts over f with holes of type  a#, from the given monadic algebra. BConstruct a monadic catamorphism from the given monadic algebra. A generalisation of  from terms over f to contexts over f, where ; the holes have the type of the monadic algebra carrier. 7This function applies the given term homomorphism to a term/ context. /Apply a term homomorphism recursively to a term/context. This is  a top-down variant of . !Compose two term homomorphisms. CCompose an algebra with a term homomorphism to get a new algebra. ECompose a term homomorphism with a coalgebra to get a cv-coalgebra. KCompose a term homomorphism with a cv-coalgebra to get a new cv-coalgebra. BThis function applies a signature function to the given context. 8This function applies a signature function to the given ( context. This is a top-down variant of . 1This function composes two signature functions. 8This function composes a signature function with a term  homomorphism. FThis function composes a term homomorphism with a signature function. =This function composes an algebra with a signature function. 9Lifts the given signature function to the canonical term  homomorphism. MLift the given signature function to a monadic signature function. Note that O term homomorphisms are instances of signature functions. Hence this function ' also applies to term homomorphisms. JLift the give monadic signature function to a monadic term homomorphism. CLift the given signature function to a monadic term homomorphism. 7Apply a monadic term homomorphism recursively to a term/ context. 3Apply a monadic term homomorphism recursively to a  term/$context. This a top-down variant of . BThis function constructs the unique monadic homomorphism from the 1initial term algebra to the given term algebra. JThis function applies a monadic signature function to the given context. @This function applies a monadic signature function to the given ( context. This is a top-down variant of . BThis function applies a signature function to the given context. )Compose two monadic term homomorphisms. 4)Compose two monadic term homomorphisms. 5)Compose two monadic term homomorphisms. HCompose a monadic algebra with a monadic term homomorphism to get a new  monadic algebra. HCompose a monadic algebra with a term homomorphism to get a new monadic  algebra. :This function composes two monadic signature functions. 6)Compose two monadic term homomorphisms. :This function composes two monadic signature functions. :This function composes two monadic signature functions. 4Construct an anamorphism from the given coalgebra. Shortcut fusion variant of . 7CConstruct a monadic anamorphism from the given monadic coalgebra. 4Construct a paramorphism from the given r-algebra. DConstruct a monadic paramorphism from the given monadic r-algebra. 6Construct an apomorphism from the given r-coalgebra. EConstruct a monadic apomorphism from the given monadic r-coalgebra. 8This function applies  at the tip of the term. 6Construct a histomorphism from the given cv-algebra. FConstruct a monadic histomorphism from the given monadic cv-algebra. 7Construct a futumorphism from the given cv-coalgebra. GConstruct a monadic futumorphism from the given monadic cv-coalgebra. CConstruct a futumorphism from the given generalised cv-coalgebra. 9:FThis function applies a signature function after a term homomorphism. ;AThis function applies the given algebra bottom-up while applying : the given term homomorphism top-down. Thereby we have no & requirements on the source signature f. <=FFFfnon-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>>?@>?@>?@gnon-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>ABCABCABC.non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>B   KProject the outermost layer of a term to a sub signature. If the signature  g is compound of n atomic signatures, use projectn instead.   Tries to coerce a termcontext to a term!context over a sub-signature. If  the signature g is compound of n atomic signatures, use   deepProjectn instead.  !"#$%&'(MInject a term where the outermost layer is a sub signature. If the signature  g is compound of n atomic signatures, use injectn instead. )*+,-./012KInject a term over a sub signature to a term over larger signature. If the  signature g is compound of n atomic signatures, use  deepInjectn  instead. 3456789:;<=>?@=This function injects a whole context into another context. A5This function lifts the given functor to a context. B7This function applies the given context with hole type a to a family f) of contexts (possibly terms) indexed by a. That is, each hole h is replaced by the context f h. CF      !"#$%&'()*+,-./0123456789:;<=>?@ABCF      !"#$%&'()*+,-./0123456789:;<=>?@ABCB      !"#$%&'()*+,-./0123456789:;<=>?@ABC/non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>DLTransform a function with a domain constructed from a functor to a function I with a domain constructed with the same functor, but with an additional  annotation. ELTransform a function with a domain constructed from a functor to a function J with a domain constructed with the same functor, but with an additional  annotation. FDStrip the annotations from a term over a functor with annotations. G)Lift a term homomorphism over signatures f and g to a term homomorphism ; over the same signatures, but extended with annotations. H1Lift a monadic term homomorphism over signatures f and g to a monadic N term homomorphism over the same signatures, but extended with annotations. I5Annotate each node of a term with a constant value. DEFGHIJDEFGHIJDEFGHI0non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk> K:This function returns a list of all subterms of the given + term. This function is similar to Uniplate's universe function. L?This function returns a list of all subterms of the given term 1 that are constructed from a particular functor. M>This function transforms every subterm according to the given = function in a bottom-up manner. This function is similar to  Uniplate's  transform function. NOMonadic version of M. PQR;This function computes the generic size of the given term, - i.e. the its number of subterm occurrences. S=This function computes the generic height of the given term. KLMNOPQRS KLMNOPQRS KLMNOPQRShnon-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>THGiven the name of a type class, where the first parameter is a functor, ( lift it to sums of functors. Example: class ShowF f where ... is lifted  as 9instance (ShowF f, ShowF g) => ShowF (f :+: g) where ... . UIUtility function to case on a functor sum, without exposing the internal  representation of sums. TUTUinon-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>VIDerive smart constructors for a type constructor of any first-order kind I taking at least one argument. The smart constructors are similar to the  ordinary constructors, but an ( is automatically inserted. VVjnon-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>WFDerive smart constructors with products for a type constructor of any K parametric kind taking at least one argument. The smart constructors are / similar to the ordinary constructors, but an  is automatically  inserted. WWnon-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>XDerive an instance of + for a type constructor of any first-order & kind taking at least one argument. YDerive an instance of  for a type constructor. #KLMNOPQRSTUVWXYZ[\]^_TUVWXY#KLMNOPQRSTXUVWXYZ\[Y]^_VWTUXY1non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>Z4This function implements equality of values of type f a modulo the equality of a4 itself. If two functorial values are equal in this sense, Z returns a " value containing a list of pairs =consisting of corresponding components of the two functorial  values. DFrom an O functor an  instance of the corresponding  term type can be derived. EO is propagated through sums. OPZOPZZknon-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>FR is propagated through sums. GFrom an R functor an  instance of the corresponding  term type can be derived. RSRS2non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>[3Fully evaluate a value over a foldable signature. ]^[]^[[lnon-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>H Instances of W" are closed under forming sums. IThis lifts instances of W to instances of  &for the corresponding context type. JThis lifts instances of W to instances of W for % the corresponding context functor. KThis lifts instances of W to instances of  "for the corresponding term type. WXYZWXYZmnon-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>LMLM3non-portable (GHC Extensions) experimental=Patrick Bahr <paba@diku.dk> and Tom Hvitved <hvitved@diku.dk>\GThis multiparameter class defines functors with variables. An instance   HasVar f v denotes that values over f% might contain and bind variables of  type v. ]Indicates whether the f constructor is a variable. ^,Indicates the set of variables bound by the f constructor. _`LAThis multiparameter class defines substitution of values of type t for  variables of type v in values of type a. ab9Convert variables to holes, except those that are bound. MMAlgebra for checking whether a variable is contained in a term, except those  that are bound. cDThis function checks whether a variable is contained in a context. NLAlgebra for generating a set of variables contained in a term, except those  that are bound. OMAlgebra for generating a list of variables contained in a term, except those  that are bound. dFThis function computes the list of variables occurring in a context. eEThis function computes the set of variables occurring in a context. fFThis function computes the set of variables occurring in a constant. gApply the given substitution. h)This function composes two substitutions s1 and s2 . That is, Dapplying the resulting substitution is equivalent to first applying s2 and then s1. \]^_`abcdefgh \]^_`bcedfagh \]^]^_`abcdefgh4non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>P/This is an auxiliary function for implementing i . It behaves  similarly as match3 but is oblivious to non-linearity. Therefore, the Esubstitution that is returned maps holes to non-empty lists of terms B(resp. contexts in general). This substitution is only a matching =substitution if all elements in each list of the substitution's range  are equal. iThis function takes a context c! as the first argument and tries to match it against the term t% (or in general a context with holes in a). The context c matches the term t if there is a matching substitution s6 that maps holes to terms (resp. contexts in general) &such that if the holes in the context c are replaced according to the substitution s , the term t$ is obtained. Note that the context c7 might be non-linear, i.e. has multiple holes that are Dequal. According to the above definition this means that holes with 5equal holes have to be instantiated by equal terms! jThis function is similar to i but instead of a context it 3matches a term with variables against a context. \]^_`Labcdefghijijij5non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>klmBThis type represents term rewriting systems (TRSs) from signature f to signature g over variables of type v. n7This type represents term rewrite rules from signature f to  signature g over variables of type v opThis type represents recursive program schemes. qCThis function tries to match the given rule against the given term D(resp. context in general) at the root. If successful, the function 9returns the right hand side of the rule and the matching substitution. rs?This function tries to apply the given rule at the root of the Cgiven term (resp. context in general). If successful, the function 7returns the result term of the rewrite step; otherwise Nothing. tBThis function tries to apply one of the rules in the given TRS at Ethe root of the given term (resp. context in general) by trying each rule one by one using s% until one rule is applicable. If no rule is applicable Nothing is returned. u2This is an auxiliary function that turns function f of type  (t -> Maybe t) into functions f' of type  t -> (t,Bool). f' x  evaluates to (y,True) if f x evaluates to Just y , and to   (x,False) if f x evaluates to Nothing. This function is useful = to change the output of functions that apply rules such as t. v>This function performs a parallel reduction step by trying to Gapply rules of the given system to all outermost redexes. If the given term contains no redexes, Nothing is returned. w>This function performs a parallel reduction step by trying to Bapply rules of the given system to all outermost redexes and then Crecursively in the variable positions of the redexes. If the given #term does not contain any redexes, Nothing is returned. xBThis function applies the given reduction step repeatedly until a normal form is reached. klmnopqrstuvwxponmlkqrstuvwxklmnopqrstuvwx6non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk> yAThis class specifies the decomposability of a functorial value. z.This function decomposes a functorial value. {0This type represents decompositions of terms. |;This type represents decompositions of functorial values. }~=This function computes the structure of a functorial value. >This function computes the arguments of a functorial value. "This function decomposes a term. yz{|}~ |~}{yz yzz{|~}}~7non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>8This type represents errors that might occur during the unification. )This type represents list of equations. =This type represents equations between terms over a specific  signature. <This function returns the most general unifier of the given :equations using the algorithm of Martelli and Montanari. 8non-portable (GHC Extensions) experimentalPatrick Bahr <paba@diku.dk>-9This type represents transition functions of generalised B deterministic top-down tree acceptors (GDDTAs) which have access  to an extended state space. ;This type is needed to construct the product of two DDTAs. ;This type represents transition functions of deterministic " top-down tree acceptors (DDTAs). ;This type represents transition functions of deterministic $ top-down tree transducers (DDTTs). 9This type represents transition functions of generalised C deterministic bottom-up tree acceptors (GDUTAs) which have access  to an extended state space. ;This type represents transition functions of deterministic # bottom-up tree acceptors (DUTAs). ;This type represents transition functions of deterministic % bottom-up tree transducers (DUTTs). @This type represents stateful term homomorphisms. Stateful term D homomorphisms have access to a state that is provided (separately)  by a DUTA or a DDTA (or both). ?This function provides access to components of the states from  below. >This function provides access to components of the state from  above Turns the explicit parameters ?above and ?below into explicit  ones. :This function transforms DUTT transition function into an  algebra. 5This function runs the given DUTT on the given term. This function generalises  to contexts. Therefore, > additionally, a transition function for the holes is needed. <This function composes two DUTTs. (see TATA, Theorem 6.4.5) AChanges the state space of the DUTA using the given isomorphism. BThis combinator runs the given DUTA on a term returning the final  state of the run. @This function combines the product DUTA of the two given DUTAs. ;This function constructs a DUTT from a given stateful term ; homomorphism with the state propagated by the given DUTA. >This function applies a given stateful term homomorphism with 7 a state space propagated by the given DUTA to a term. 6This combinator turns an arbitrary DUTA into a GDUTA. ?This combinator turns a GDUTA with the smallest possible state  space into a DUTA. (This combinator runs a GDUTA on a term. 5This combinator constructs the product of two GDUTA. 6Thsis function runs the given DDTT on the given tree. 5This function runs the given DDTT on the given tree. ;This function composes two DDTTs. (see Z. Flp, H. Vogler  Syntax-Directed Semantics, Theorem 3.39) AChanges the state space of the DDTA using the given isomorphism. BThis function constructs the product DDTA of the given two DDTAs. @This function constructs the pointwise product of two maps each  with a default value. ?Apply the given state mapping to the given functorial value by E adding the state to the corresponding index if it is in the map and . otherwise adding the provided default state. wThis function constructs a DDTT from a given stateful term-- homomorphism with the state propagated by the given DDTA. @This function applies a given stateful term homomorphism with a 5 state space propagated by the given DDTA to a term. 6This combinator turns an arbitrary DDTA into a GDDTA. ?This combinator turns a GDDTA with the smallest possible state  space into a DDTA. 5This combinator constructs the product of two GDDTA. 0?@A--nnon-portable (GHC Extensions) experimental:Patrick Bahr <paba@diku.dk>, Tom Hvitved <hvitved@diku.dk>OPRS      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSZ9non-portable (GHC Extensions) experimentalTom Hvitved <hvitved@diku.dk>"The desugaring term homomorphism. Desugar a term. $Lift desugaring to annotated terms. QDefault desugaring instance. Ropqorsotuvwxvwyvwz{|}{|~                                                                           ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 89:;<=>?@ABCDEFGHHIJJKLLMNOPQRSTUVWXYZ[\EGHHIJJKLLM]^_`abcde=f=g=hiijklmnop>q?r?s?t@u@v@wAxAyAzB{C|D}D~DDDDEEEFFFFFGHIJKLLLLLMNOPQQSSSSSTcUUUUUU                                  ! " # $ % & ' ( ) * + 0 1  , - . /!2!7!3!4!5!8"""""""""XYZZ#$$$$$$$$$$$$$$%%%%%&&&&&&&&&&&&&&&&&'''''''''''''''''''''''' ' ' ' ' ''''''''''''''''''' '!'"'#'$'%'&'''(')'*'+','-'.'/'0'1(2(3(4(5(6(7(8)));)<`a***?*@bcdd+++++,,,d,,,,,,,,,,,e--------------------------------------------c--------------------------........................ . . . . ................... .!.".#.$.%.&.'.(.).*.+.,.-.../.0.1../2/3/4/5/6/7/8000000000hhij12333333333333344555555555555556666666667777777777777777777778888 8 8 8 8 8888888888888888888 8!8"8#8$8%8&8'8(8)8*8+8,8-8.8/8081829999934o56op7 8 9 : ;  < = > ? @ A B:C:D:E;F;G;HIJoKLMNOoKPQRSopT89=U=V=W=X=Y=Z=[=\=]=^=_=`ab>c>d>e>f>g>h>i>j>k>l>m?nAoDpDqDrKoRsRtuUnVCVDVEWFWGWHovw#x#y$z${${$|$}$~$%u]C]D]E^F^G^H)I))*N**boese+u-:-;-<--=->-?-@-A-BfCfDfEgFgGgH11kkllll3z3}33~49ucompdata-0.4.1Data.Comp.DeriveData.Comp.MultiParam.AlgebraData.Comp.MultiParam.FreshMData.Comp.MultiParam.AnyData.Comp.Param.FreshMData.Comp.Param.AnyData.Comp.Param.DifunctorData.Comp.Param.DitraversableData.Comp.Param.OpsData.Comp.Param.TermData.Comp.Param.AlgebraData.Comp.Param.SumData.Comp.Param.AnnotationData.Comp.Param.EqualityData.Comp.Param.OrderingData.Comp.Multi.FunctorData.Comp.Multi.FoldableData.Comp.Multi.TraversableData.Comp.MultiParam.HDifunctor#Data.Comp.MultiParam.HDitraversableData.Comp.MultiParam.TermData.Comp.Multi.TermData.Comp.Automata.ProductData.Comp.ZippableData.Comp.Param.DeriveData.Comp.Multi.DeriveData.Comp.Param.DesugarData.Comp.MultiParam.Derive Data.Comp.OpsData.Comp.Multi.AlgebraData.Comp.Multi.OpsData.Comp.Multi.SumData.Comp.Multi.AnnotationData.Comp.Multi.GenericData.Comp.Multi.EqualityData.Comp.Multi.VariablesData.Comp.Multi.DesugarData.Comp.MultiParam.OpsData.Comp.MultiParam.SumData.Comp.MultiParam.AnnotationData.Comp.MultiParam.EqualityData.Comp.MultiParam.OrderingData.Comp.MultiParam.DesugarData.Comp.TermData.Comp.Algebra Data.Comp.SumData.Comp.AnnotationData.Comp.GenericData.Comp.EqualityData.Comp.DeepSeqData.Comp.VariablesData.Comp.MatchingData.Comp.TermRewritingData.Comp.DecomposeData.Comp.UnificationData.Comp.AutomataData.Comp.Desugar"Data.Comp.Param.Derive.Projections!Data.Comp.Param.Derive.InjectionsData.Comp.Param!Data.Comp.Automata.Product.DeriveData.Comp.Derive.UtilsData.Comp.Derive.ShowData.Comp.Derive.EqualityData.Comp.Derive.OrderingData.Comp.Derive.FoldableData.Comp.Derive.TraversableData.Comp.Derive.ArbitraryData.Comp.Derive.DeepSeqData.Comp.Multi.Derive.EqualityData.Comp.Multi.Derive.FunctorData.Comp.Multi.Derive.Foldable"Data.Comp.Multi.Derive.TraversableData.Comp.Param.Derive.EqualityData.Comp.Param.Derive.OrderingData.Comp.Param.Derive.Show Data.Comp.Param.Derive.Difunctor$Data.Comp.Param.Derive.Ditraversable(Data.Comp.Param.Derive.SmartConstructors)Data.Comp.Param.Derive.SmartAConstructorsData.Comp.Param.Derive.LiftSumData.Comp.Param.Show Data.Comp.MultiParam.Derive.Show&Data.Comp.MultiParam.Derive.HDifunctorData.Comp.Multi.Derive.Show"Data.Comp.Multi.Derive.Projections!Data.Comp.Multi.Derive.Injections(Data.Comp.Multi.Derive.SmartConstructors)Data.Comp.Multi.Derive.SmartAConstructorsData.Comp.Multi.Derive.LiftSumData.Comp.MultiData.Comp.Multi.Show'Data.Comp.MultiParam.Derive.Projections&Data.Comp.MultiParam.Derive.InjectionsData.Comp.MultiParam$Data.Comp.MultiParam.Derive.Equality-Data.Comp.MultiParam.Derive.SmartConstructors$Data.Comp.MultiParam.Derive.Ordering.Data.Comp.MultiParam.Derive.SmartAConstructors#Data.Comp.MultiParam.Derive.LiftSumData.Comp.MultiParam.ShowData.Comp.Derive.ProjectionsData.Comp.Derive.InjectionsData.Comp.Derive.LiftSum"Data.Comp.Derive.SmartConstructors#Data.Comp.Derive.SmartAConstructorsData.Comp.OrderingData.Comp.ArbitraryData.Comp.Show Data.CompbaseGHC.BaseFunctor Data.FoldableFoldableData.Traversable TraversableQuickCheck-2.4.1.1Test.QuickCheck.Arbitraryshrink arbitrary Arbitrarydeepseq-1.1.0.2Control.DeepSeqrnfNFDatatransformers-0.2.2.0Data.Functor.Compose getComposeComposeVarFreshMvarEq varComparevarShow varCoercegenVar evalFreshMAny Difunctordimapdifmap DitraversabledimapM disequenceRemAremADistAnninjectAprojectA:&::*::<:injproj:+:InrInlffstfsndConstTermTrmContextNoHoleHoleCxtPlacesimpCxt coerceCxttoCxt constTermfmapCxt dimapMCxt disequenceCxtCVCoalg'CVCoalgMCVCoalgCVAlgMCVAlgRCoalgMRCoalgRAlgMRAlgCoalgMCoalgHomMDHomMSigFunMDCxtFunMSigFunMHomSigFunCxtFunAlgMAlgfreecatacata'appCxtalgMfreeMcataMcataM'appHomappHom'compHomcompAlg compAlgSigFun appSigFun appSigFun' compSigFun compHomSigFun compSigFunHomhomsigFunMhomMappHomMappHomM'homMD appSigFunM appSigFunM' appSigFunMDcompHomMcompSigFunHomMcompAlgM compAlgM'compAlgSigFunMcompAlgSigFunM' compSigFunManaanaMparaparaMapoapoMhistohistoMfutufutuMfutu'proj2proj3proj4proj5proj6proj7proj8proj9proj10projectproject2project3project4project5project6project7project8project9 project10 deepProject deepProject2 deepProject3 deepProject4 deepProject5 deepProject6 deepProject7 deepProject8 deepProject9 deepProject10inj2inj3inj4inj5inj6inj7inj8inj9inj10injectinject2inject3inject4inject5inject6inject7inject8inject9inject10 deepInject deepInject2 deepInject3 deepInject4 deepInject5 deepInject6 deepInject7 deepInject8 deepInject9 deepInject10 injectConst injectConst2 injectConst3 projectConst injectCxtliftCxtliftAliftA'stripApropAnnpropAnnMannproject'EqDeqDPEqpeqOrdDcompareDPOrdpcompare:.:CompHFunctorhfmapNatM:=>:->AunAKunKIunI HFoldablehfoldhfoldMaphfoldrhfoldlhfoldr1hfoldl1htoListkfoldrkfoldl HTraversablehmapM htraverse HDifunctorhdimapHDitraversablehdimapMhfmapCxt hdimapMCxtAlgM'freeM'hom'NothingunTerm:<prupNumberedZippableStreamCons<:> unNumberednumbernumber'deriveShowFshowF makeShowFEqFeqFmakeEqFOrdFcompareFmakeOrdF makeFoldablemakeTraversable ArbitraryF arbitraryF' arbitraryFshrinkF makeArbitrarymakeArbitraryFNFDataFrnfF makeNFDataFHEqFheqFKEqkeqmakeHEqF makeHFunctor makeHFoldablemakeHTraversablemakeEqDmakeOrdDShowDshowDPShowpshow makeShowD makeDifunctormakeDitraversablesmartConstructorssmartAConstructorsliftSumcaseDDesugardesugHom desugHom'desugardesugarAShowHDshowHD makeShowHDmakeHDifunctorliftMAlgKShowkshowHShowFhshowFhshowF' makeHShowFfstsnd substHolessubterms subterms' transform transformMquerysubssubs'sizedepthcaseHheqModHasVarsisVar bindsVarsSubstCxtSubstGSubst substVars varsToHoles containsVar variableList variables variables'appSubst compSubstEqHDeqHDmakeEqHDOrdHD compareHD makeOrdHDcaseHDPTerm compCoalg compCVCoalgcompHomSigFunMana' substHoles' transform'gsizeheightcaseF makeFunctor makeNFDataeqModrnfF'matchCxt matchTermBStepStepTRSRuleRPS matchRule matchRulesappRuleappTRSbStep parTopStep parallelStepreduce Decomposedecomp DecompTermDecompFun structure arguments decomposeUnifyM UnifyStateusEqsusSubst UnifErrorHeadSymbolMismatchFailedOccursCheck EquationsEquationfailedOccursCheckheadSymbolMismatch appSubstEqunify runUnifyM withNextEqputEqs putBindingrunUnify unifyStep DDownState ProdStateBStateRStateLState DownState DownTransDUpStateUpStateUpTransQHom&|->obelowaboveexplicitupAlg runUpTrans runUpTrans' compUpTrans tagUpState runUpState prodUpStateupTransrunUpHomdUpStateupState runDUpState prodDUpState<*> runDownTrans runDownTrans' compDownTrans tagDownState prodDownStateprodMapappMap downTrans runDownHom dDownState downStateprodDDownState>*< runDState$fDifunctor(->)$fDitraversable(->)MaybeAny Unsafe.Coerce unsafeCoercefmapCxtFunM' coerceCxtFunM compHomM' compHomM_compSigFunHomM' projectTip appAlgHom appSigFunHom appAlgHomM appHomHomM appSigFunHomMprojnprojectn deepProjectninjninjectn deepInjectn$fEqCxt$fEqDCxt GHC.ClassesEq$fEqD:+:$fOrdCxt $fOrdDCxtOrd $fOrdD:+: $fHFunctorf$fHDitraversablefmaMonadDirRL genAllInstsgenDirsgenInstgenTypegenPatgenExgenUp genPatExppairTfzipfzipWithabstractNewtypeQabstractNewtype normalCon normalCon' normalConExpabstractConType containsType containsType'newNames tyVarBndrName tupleTypes showConstrcompListgenerateArbitraryFDeclgenerateGenDeclgenerateShrinkFDecl $fShowCxt $fShowDCxt $fDesugarfg Data.MaybeJust $fHEqFCxt $fHEqF:+: SubstVarsCunCcontainsVarAlgvariableListAlg variablesAlg $fEqHDCxt $fEqHD:+: $fOrdHDCxt $fOrdHD:+: $fPShowCxtbuild$fEqFCxt$fEqF:+: $fOrdF:+: $fOrdFCxt$fArbitraryF:+:$fArbitraryCxt$fArbitraryFCxt$fArbitraryCxt0 matchCxt'