pe6      !"#$%&'()*+,-./012345portable experimental*Niklas Broberg, niklas.broberg@chalmers.seNone"6>A simple datatype to annotate return values from sub-patterns 75A simple annotation datatype for statement contexts. ?Transform away occurences of regular patterns from an abstract ' Haskell module, preserving semantics. 8<Transform a declaration by transforming subterms that could  contain regular patterns. 9Transform a function match" by generating pattern guards and B declarations representing regular patterns in the argument list. F Subterms, such as guards and the right-hand side, are also traversed  transformed. :ATransform and update guards and right-hand side of a function or B pattern binding. The supplied list of guards is prepended to the > original guards, and subterms are traversed and transformed. ;HPlace declarations of postponed regular patterns in a let-expression to G make them lazy, in order to make them behave as irrefutable patterns. <3Make pattern binds from postponed regular patterns .Transform expressions by traversing subterms. H Of special interest are expressions that contain patterns as subterms,  i.e. let, case6 and lambda expressions, and also list comprehensions  and do;-expressions. All other expressions simply transform their  sub-expressions, if any. = Of special interest are of course also any xml expressions. =.Transform expressions by traversing subterms. H Of special interest are expressions that contain patterns as subterms,  i.e. let, case6 and lambda expressions, and also list comprehensions  and do;-expressions. All other expressions simply transform their  sub-expressions, if any. = Of special interest are of course also any xml expressions. >-Transform pattern bind declarations inside a let-expression by transforming S subterms that could appear as regular patterns, as well as transforming the bound Q pattern itself. The reason we need to do this in a special way is scoping, i.e.  in the expression let a | Just b <- match a = list in b the variable b will not  be in scope after the in9. And besides, we would be on thin ice even if it was in P scope since we are referring to the pattern being bound in the guard that will P decide if the pattern will be bound... yikes, why does Haskell allow guards on V pattern binds to refer to the patterns being bound, could that ever lead to anything  but an infinite loop?? ?OTransform binding of implicit parameters by transforming the expression on the N right-hand side. The left-hand side can only be an implicit parameter, so no  regular patterns there... @>Transform statements by traversing and transforming subterms. > Since generator statements have slightly different semantics A depending on their context, statements are annotated with their A context to ensure that the semantics of the resulting statement @ sequence is correct. The return type is a list since generated = guards will be added as statements on the same level as the  statement to be transformed. ATransform alternatives in a case-expression. Patterns are : transformed, while other subterms are traversed further. BFGenerate variables as placeholders for any regular patterns, in order K to place their evaluation elsewhere. We must likewise move the evaluation 9 of Tags because attribute lookups are force evaluation. C!Rename declarations appearing in lets or where clauses. D)Move irrefutable regular patterns into a let-expression instead, $ to make sure that the semantics of ~ are preserved. E8Transform several patterns in the same context, thereby 4 generating any code for matching regular patterns. F/Transform several patterns in the same context G3Transform a pattern by traversing the syntax tree. 5 A regular pattern is translated, other patterns are  simply left as is. H2Transform away a regular pattern, generating code  to replace it. IFunctions and ids from the Match module, * used in the generated matching functions JFunctions and ids from the Match module, * used in the generated matching functions KFunctions and ids from the Match module, * used in the generated matching functions LFunctions and ids from the Match module, * used in the generated matching functions MSome magic& gensym-like functions, and functions  with related functionality. N:Create an xml tag, given its domain, name, attributes and  children. O@Create an empty xml tag, given its domain, name and attributes. P/Create an attribute by applying the overloaded asAttr Q1Create a property from an attribute and a value. RDMake xml out of some expression by applying the overloaded function  asChild. S.Lookup an attribute in the set of attributes. T3Generate a pattern under the Tag data constructor. U6Generate a pattern under the PCDATA data constructor. V6WXYZ[\]^_`ab7cdefghijklmn8op9:;<=qrstu>?@vAwxyz{|}~BCDEFGHIJKLMNOPQRSTUV6ZYXW[\]^_`ab7edcfghijklmn8op9:;<=qrstu>?@vAwxyz{|}~BCDEFGHIJKLMNOPQRSTU0requires newtype deriving and MPTCs with fundeps experimental*Niklas Broberg, niklas.broberg@chalmers.seNone HNames can be simple or qualified with a domain. We want to conveniently ? use both simple strings or pairs wherever a Name is expected. Set attributes on XML elements 8Similarly embed values as attributes of an XML element. MEmbed values as child nodes of an XML element. The parent type will be clear * from the context so it is not mentioned. "=Type synonyms to avoid writing out the XMLnGenT all the time #0Generate XML values in some XMLGenerator monad. ,BThe monad transformer that allows a monad to generate XML values. . un-lift. /map the inner monad NPairs of strings can represent names, meaning a name qualified with a domain. CStrings can represent names, meaning a simple name with no domain. &Names can represent names, of course. J  !"#$%&'()*+,-./0123454  !"#$%&'()*+,-./0123454,-./+#$%&'()*"! 102435  4    !"#$%&'()*+,-./012345      !"#$%&'()*+,-.//0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]]^_`aabcdefghijklmnopqrstuvwxyz{|}~ hsx-0.10.5 HSX.TransformHSX.XMLGenerator transform transformExp TypeCastM'' typeCastM'' TypeCastM' typeCastM' TypeCastM typeCastM TypeCast'' typeCast'' TypeCast' typeCast'TypeCasttypeCastIsNametoName AppendChildappChildappAllSetAttrsetAttrsetAllAttr:= XMLGenerator EmbedAsAttrasAttr EmbedAsChildasChildGenAttributeList GenAttribute GenChildListGenChild GenXMLListGenXMLXMLGenXMLType ChildType AttributeType genElement genEElement xmlToChild pcdataToChildNameXMLGenT unXMLGenT mapXMLGenTset<@<<@app<:<<:MTypeStmtType transformDecltransformMatchmkRhs addLetDeclsmkDecl transformExpMtransformLetDeclstransformIPBind transformStmt transformAlt renameRPatsrenameLetDecls renameIrrPatstransformPatterns trPatterns trPatterntrRPat runMatchFun baseMatchFun manyMatchFun gManyMatchFunretnamemetaGenElementmetaGenEElement metaAsAttr metaAssign metaAsChild metaExtractmetaTag metaPcdata MFunMetaInfoMELSTrStateNameBindRNStateRNGuard ListCompStmt GuardStmtDoStmtHsxStateHsxMMkHsxM getHsxState setHsxState initHsxStatesetHarpTransformedsetXmlTransformedrunHsxMtransformInstDecltransformClassDecltransformFieldUpdatetransformSplice transform2exp transform3expmkAttrtransformQualStmt mkStmtGuard mkDeclGuard initRNState runRename getRNState setRNState genVarName rename1pat rename2pat renameNpatrenameRP renameIrrPliftTr initState initStateFromrunTr runTrFromTogetStatesetState updateState pushGuardpushDecl pushAttrGuard genMatchName genPatName genAttrNamesetHarpTransformedTsetXmlTransformedTtr1pattr2pattrNpat runMatch_namebaseMatch_namemanyMatch_namegManyMatch_name match_modmatch_qual_mod match_qualchoiceOpappendOp foldCompFun mkMetaUnzip matchFunctionvarsnamevalnamevalsname valsvarsname mkValName extendVar xNameParts metaReturn metaConst metaUnzip metaEither metaMaybe metaConcatmetaMap metaAppend metaChoice metaPConsmetaConsmetaComp metaPJust metaPNothing metaPMkMaybemetaJust metaNothing metaMkMaybeconsFunidFunconconsfcompchoiceappend just_name nothing_name left_name right_name argAsAttr metaMkName $fFunctorTr $fMonadTr $fFunctorRN $fMonadRN $fFunctorHsxM $fMonadHsxM $fIsName(,) $fIsName[] $fIsName(,)0$fTypeCastM''()mama$fTypeCastM'tmamb$fTypeCastMmamb$fTypeCast''()aa$fTypeCast'tab $fTypeCastab$fAppendChildmXMLGenT$fSetAttrmXMLGenT$fEmbedAsAttrm[]$fEmbedAsAttrmAttributeType$fEmbedAsAttrmAttr$fEmbedAsAttrmXMLGenT$fEmbedAsChildm()$fEmbedAsChildm[]$fEmbedAsChildmx$fEmbedAsChildmChildType$fEmbedAsChildm[]0$fEmbedAsChildmXMLGenT$fMonadTransXMLGenT