úÎ [2VêI      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGH non-portable experimentalgenerics@haskell.org*corresponding embedding-projection pairs. The type class Regular. captures the structural representation of a 8 type and the corresponding embedding-projection pairs. KTo be able to use the rewriting functions, the user is required to provide ! an instance of this type class. !The well-known fixed-point type. 3Structure type to store the name of a constructor. ,Structure type for fields of a constructor. +Structure type for alternatives in a type. 'Structure type for empty constructors. %Structure type for recursive values. $Structure type for constant values.        non-portable experimentalgenerics@haskell.org The LR class defines two functions, leftf and rightf, which should & produce different functorial values. The LRBase class defines two functions, leftb and rightb , which " should produce different values. The GShow! class defines a show on values. The Zip3 class defines a monadic zip on functorial values. The Crush6 class defines a crush on functorial values. In fact,  crush is a generalized foldr. The GMap) class defines a monadic functorial map. !<Flatten a structure by collecting all the elements present. "JFunctorial zip with a non-monadic function, resulting in a monadic value. #4Partial functorial zip with a non-monadic function. $=Equality on values based on their structural representation. %GProduces a value which should be different from the value returned by  right. &GProduces a value which should be different from the value returned by  left. IJ !"#$%& !"#$%& !"#$%& non-portable experimentalgenerics@haskell.org'The type class Builder- captures the functions, that are defined by < induction on the type argument, that construct appropriate left and  rightA values. These values are used to transform a rule specification  to a rule. +;A view on schemes to easily distinguish metavariables from  pattern functor values. ./Allows metavariables on either side of a rule. /(Extends the pattern functor of a value. K;Recursively extends a type with a case for a metavariable. L:Extends a pattern functor with a case for a metavariable. 1+Specifies a rule as a value of a datatype. 3&Returns the left-hand side of a rule. 4'Returns the right-hand side of a rule. 5Constructs a metavariable. 6$Constructs a pattern functor value. 7'Returns the value corresponding to the  SchemeView. 8"Recursively converts a value to a SchemeOf value. 9Folds a Scheme8 value given a function to apply to metavariables and a / function to apply to a pattern functor value. :HTransforms a rule specification to a rule and throws a runtime error if D an unbound metavariable occurs in the right-hand side of the rule. ;6Transforms a rule specification to a rule and returns Nothing if D an unbound metavariable occurs in the right-hand side of the rule. MHMerges two schemes by preferring the metavariables that occur in either  of the two arguments. NFInserts a metavariable in the right place by zipping two instances of H the function that are applied to different values. These values ensure J that the zipping process fails exactly at the point where a metavariable  is required to be inserted. '()*+,-./0123456789:;1234./0568+-,79'()*;:'()*()*+-,,-./01223456789:; non-portable experimentalgenerics@haskell.org OBA substitution maps a metavariable to a pair of the original term F and the converted term. Both are stored to improve efficiency, since H the right-hand side of a term may caontain multiple occurrences of the  same metavariable. <The Rewrite< is a type class synonym, hiding some of the implementation  details. KTo be able to use the rewriting functions, the user is required to provide ! an instance of this type class. =CApplies a rule specification to a term, obtaining a monadic value. >EApplies a rule specification to a term, obtaining the original term  when rewriting fails. ?,Rewrites a term, obtaining a monadic value. @CRewrites a term, obtaining the original term when rewriting fails. P0Matches a term to the left-hand side of a rule. Q"Applies a substitution to a term. RIInstantiates all the metavariables in a term, assuming that there are no $ unbound metavariables in the term. <=>?@<=>?@<=>?@ non-portable experimentalgenerics@haskell.org SHSame monad to that in the SYB3 paper. It is used as follows: the first I argument contains the original value, and the second arguments contain  the transformed values. ALApplies a function to the first subtree (possibly the tree itself) on which * it succeeds, using a preorder traversal. BQApplies a function to the first immediate child of a value on which it succeeds. C?Applies a monadic function exhaustively in a top-down fashion. D6Applies a function exhaustively in a top-down fashion E@Applies a monadic function exhaustively in a bottom-up fashion. F7Applies a function exhaustively in a bottom-up fashion GEApplies a monadic function to all the immediate children of a value. H=Applies a function to all the immediate children of a value. ABCDEFGHABCDEFGHABCDEFGH non-portable experimentalgenerics@haskell.orgKIJ  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHT       !"#$%&'()*+,-./0.123456789:;<=>?@ABCDEFGH+IJ+IKLMNOPQRSTU rewriting-0.1*Generics.Regular.Rewriting.RepresentationsGenerics.Regular.Rewriting.Base Generics.Regular.Rewriting.Rules$Generics.Regular.Rewriting.Machinery%Generics.Regular.Rewriting.StrategiesGenerics.Regular.RewritingRegularPFfromtoFixInCon:*::+:RLUnitIdKLRleftfrightfLRBaseleftbrightbGShowgshowZipfzipMCrushcrushGMapfmapMflattenfzipfzip'geqleftrightBuilderTargetbasediag SchemeViewMetavarRuleSchemeOfRuleSpec:~>lhsRrhsRmetavarpf schemeViewtoScheme foldSchemeruleruleMRewrite applyRuleM applyRulerewriteMrewriteonceonetopdownMtopdown bottomupMbottomupcomposMcomposGHC.BaseFunctorfmapSchemeExt mergeSchemes insertMetavarSubstmatchapplyinstS