A.       !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~  None!"+-./134579>CIKLN Higher-kinded version of  Force a symbol to normal form"Typed" symbol. Using  sym instead of sym gives access to the function - for casting expressions.Existential quantification of  -indexed typeExistential quantificationEmpty symbol type Can be used to make uninhabited !g types. It can also be used as a terminator in co-product lists (e.g. to avoid overlapping instances): (A :+: B :+: Empty) Symbol injectionThe class includes types sub and sup where sup is of the form (...   sub   ...). Injection from sub to sup Symbol projectionThe class is defined for all pairs of types, but   can only succeed if sup is of the form (...   sub   ...). Partial projection from sup to sub  Direct sum of two symbol domains7Returns the symbol in the result of a smart constructorDMaps a smart constructor type to the corresponding symbol signature: USmartSig (ASTF sym a -> ASTF sym b -> ... -> ASTF sym x) = a :-> b :-> ... :-> Full xKMaps a symbol signature to the type of the corresponding smart constructor: YSmartFun sym (a :-> b :-> ... :-> Full x) = ASTF sym a -> ASTF sym b -> ... -> ASTF sym xValid symbols to use in an !Reify the signature of a symbol4The result type of a symbol with the given signatureValid symbol signatures*Witness of the arity of a symbol signature6Signature of a partially applied (or unapplied) symbol#Signature of a fully applied symbol "Fully applied abstract syntax tree!>Generic abstract syntax tree, parameterized by a symbol domain(! sym (a  b))] represents a partially applied (or unapplied) symbol, missing at least one argument, while (! sym ( a))A represents a fully applied symbol, i.e. a complete syntax tree.$"Count the number of symbols in an !%&Make a smart constructor of a symbol. & has any type of the form: gsmartSym :: sym (a :-> b :-> ... :-> Full x) -> (ASTF sym a -> ASTF sym b -> ... -> ASTF sym x)&&Make a smart constructor of a symbol. & has any type of the form: |smartSym :: (sub :<: AST sup) => sub (a :-> b :-> ... :-> Full x) -> (ASTF sup a -> ASTF sup b -> ... -> ASTF sup x)'&Make a smart constructor of a symbol. ' has any type of the form: smartSymTyped :: (sub :<: AST (Typed sup), Typeable x) => sub (a :-> b :-> ... :-> Full x) -> (ASTF sup a -> ASTF sup b -> ... -> ASTF sup x),Inject a symbol in an ! with a  domain-Type cast an expression.%Constrain a symbol to a specific type/$Projection to a specific symbol type If sub is not in sup,   always returns  .H  !"#$%&'()*+,-Expression to cast!Witness for typeability of result./   !"#0  !"#$%&'()*+,-./0!"# $%  &'()*+,-./7    !"#$%&'()*+,-./   !"#  #None!"+-./134579>CIKLN0=Can be used to make an arbitrary type constructor indexed by ( a)7. This is useful as the type constructor parameter of 3. That is, use Args (WrapFull c) ... instead of  Args c ...if c is not indexed by ( a).3List of symbol arguments6wMap a function over all immediate sub-terms (corresponds to the function with the same name in Scrap Your Boilerplate)7Map a function over all immediate sub-terms, collecting the results in a list (corresponds to the function with the same name in Scrap Your Boilerplate)8)Apply a transformation bottom-up over an ! (corresponds to  everywhere in Scrap Your Boilerplate)9(Apply a transformation top-down over an ! (corresponds to  everywhere' in Scrap Your Boilerplate):#List all sub-terms (corresponds to universe in Uniplate);Map a function over an 31 list and collect the results in an ordinary list<Map a function over an 3 list=$Map an applicative function over an 3 list>Map a monadic function over an 3 list?Right fold for an 3 list@>Apply a (partially applied) symbol to a list of argument termsA"Pattern match" on an !S using a function that gets direct access to the top-most symbol and its sub-treesB A version of A with a simpler result typeCFold an ! using an 3& list to hold the results of sub-termsDSimplified version of CB for situations where all intermediate results have the same typeEFold an !. using a list to hold the results of sub-termsF A version of AO where the result is a transformed syntax tree, wrapped in a type constructor cGUpdate the symbols in an ASTH Convert an ! to a $012%&'3456789:;<=>?@ABCDEFGH0123456789:;<=>?@ABCDEFGH7689:345;<=>?@EABCDFG012H012%&'3456789:;<=>?@ABCDEFGH5 None!"+-./134579>CIKLNIConvert a symbol to a $ of stringsJConvert a symbol to a $ given a list of argument treesKQRender a symbol as concrete syntax. A complete instance must define at least the L method.LShow a symbol as a (M2Render a symbol given a list of rendered argumentsNHigher-kinded equalityOHigher-kinded equality}Comparing elements of different types is often needed when dealing with expressions with existentially quantified sub-terms.P<Higher-kinded hashing. Elements that are equal according to O must result in the same hash:  equal a b ==> hash a == hash bQImplementation of M that handles infix operatorsR Render an ! as concrete syntaxS Convert an ! to a $ of stringsT"Show a syntax tree using ASCII artU#Print a syntax tree using ASCII artV7Write a syntax tree to an HTML file with foldable nodesWDefault implementation of OXDefault implementation of PIJKLMNOPQRSTUVWX)*+,-./012345IJKLMNOPQRSTUVWXNOPKLMQRIJSTUVWXIJKLMNOPQRSTUVWX)*+,-./012345None!"+-./134579>CIKLNYN-ary syntactic functionsZ has any type of the form: 3desugarN :: ( Syntactic a , Syntactic b , ... , Syntactic x , Domain a ~ sym , Domain b ~ sym , ... , Domain x ~ sym ) => (a -> b -> ... -> x) -> ( ASTF sym (Internal a) -> ASTF sym (Internal b) -> ... -> ASTF sym (Internal x) )...and vice versa for [.\It is usually assumed that (_ (` a)) has the same meaning as a.aSyntactic type castingb"Sugared" symbol applicationb has any type of the form: sugarSym :: ( sub :<: AST sup , Syntactic a , Syntactic b , ... , Syntactic x , Domain a ~ Domain b ~ ... ~ Domain x ) => sub (Internal a :-> Internal b :-> ... :-> Full (Internal x)) -> (a -> b -> ... -> x)c"Sugared" symbol applicationc has any type of the form: sugarSymTyped :: ( sub :<: AST (Typed sup) , Syntactic a , Syntactic b , ... , Syntactic x , Domain a ~ Domain b ~ ... ~ Domain x , Typeable (Internal x) ) => sub (Internal a :-> Internal b :-> ... :-> Full (Internal x)) -> (a -> b -> ... -> x)YZ[\]^_`abcdef YZ[\]^_`abc\]^_`faYZ[edbcYZ[\]^_`abcdefNone!"+-./134579>CIKLN g=Decorating symbols or expressions with additional information One usage of gM is to decorate every node of a syntax tree. This is done simply by changing  AST sym sigto AST (sym :&: info) sigkMap over a decorationl(Get the decoration of the top-level nodem+Update the decoration of the top-level nodenZLift a function that operates on expressions with associated information to operate on a gD expression. This function is convenient to use together with e.g. queryNodeSimple when the domain has the form (sym g info).oStrip decorations from an !p#Rendering of decorated syntax treesq-Show an decorated syntax tree using ASCII artr.Print an decorated syntax tree using ASCII artghijklmnopqrstuvwxy ghijklmnopqrsghijyxwvutklmnopqrsghijklmnopqrstuvwxyNone!"+-./134579>CIKLNq  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcghijklmnopqrsNone!"+-./134579>CIKLN#z Evaluation|Runtime environment}3Monadic denotation; mapping from a symbol signature a :-> b :-> Full cto m a -> m b -> m c4Semantic function type of the given symbol signatureEnvironment used by Reifiable monadSSee "Generic Monadic Constructs for Embedded Languages" (Persson et al., IFL 2011  Ahttp://www.cse.chalmers.se/~emax/documents/persson2011generic.pdf).!It is advised to convert to/from  using the \# instance provided in the modules Language.Syntactic.Sugar.Monad or Language.Syntactic.Sugar.MonadT.Monadic constructsSSee "Generic Monadic Constructs for Embedded Languages" (Persson et al., IFL 2011  Ahttp://www.cse.chalmers.se/~emax/documents/persson2011generic.pdf).A symbol for let bindingsThis symbol is just an application operator. The actual binding has to be done by a lambda that constructs the second argument.2Domains that "might" include variables and bindersTyped variables and bindersVariables and binders Variable name!Generic N-ary syntactic construct` gives a quick way to introduce a syntactic construct by giving its name and semantic function.Literal(Get the highest name bound by the first 7 binders at every path from the root. If the term has ordered binders [1], 7 returns the highest name introduced in the whole term.,[1] Ordered binders means that the names of 6 nodes are decreasing along every path from the root.AHigher-order interface for variable binding for domains based on  Assumptions: The body f does not inspect its argument. Applying f7 to a term with ordered binders results in a term with ordered binders [1].,[1] Ordered binders means that the names of 6 nodes are decreasing along every path from the root.CSee "Using Circular Programs for Higher-Order Syntax" (ICFP 2013,  @http://www.cse.chalmers.se/~emax/documents/axelsson2013using.pdf).+Higher-order interface for variable bindingThis function is  specialized to domains sym satisfying (   sym).EConvert from a term with De Bruijn indexes to one with explicit namesIn the argument term, variable /s are treated as De Bruijn indexes, and lambda Os are ignored. (Ideally, one should use a different type for De Bruijn terms.)(Get the highest name bound by the first 7 binders at every path from the root. If the term has ordered binders [1], 7 returns the highest name introduced in the whole term.,[1] Ordered binders means that the names of 6 nodes are decreasing along every path from the root.+Higher-order interface for variable binding Assumptions: The body f does not inspect its argument. Applying f7 to a term with ordered binders results in a term with ordered binders [1].,[1] Ordered binders means that the names of 6 nodes are decreasing along every path from the root.CSee "Using Circular Programs for Higher-Order Syntax" (ICFP 2013,  @http://www.cse.chalmers.se/~emax/documents/axelsson2013using.pdf).+Higher-order interface for variable bindingThis function is  specialized to domains sym satisfying (   sym).+Higher-order interface for variable bindingThis function is  specialized to domains sym satisfying (sym ~  s,    s).'One-layer desugaring of monadic actions'One-layer desugaring of monadic actions.Get the set of free variables in an expressionRGet the set of variables (free, bound and introduced by lambdas) in an expressionAlpha-equivalence EvaluationLift a  to }Simple implementation of { from a 6&"Compile" a term to a Haskell functionEvaluation of open terms!Evaluation of closed terms where |$ is used as the internal environmentC(Note that there is no guarantee that the term is actually closed.)7O> does strict identifier comparison; i.e. no alpha equivalence.P} assigns the same hash to all variables and binders. This is a valid over-approximation that enables the following property:  a b ==> P a == P b8O> does strict identifier comparison; i.e. no alpha equivalence.P} assigns the same hash to all variables and binders. This is a valid over-approximation that enables the following property:  a b ==> P a == P bnz{|}~Variable constructorLambda constructorVariable constructorLambda constructor9:;6<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ab7cdef8ghijklmnopq2z{|}~2~}|z{^z{|}~9:;6<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ab7cdef8ghijklmnopqNone!"+-./134579>CIKLNrA sub-expression chosen to be shared together with an evidence that it can actually be shared in the whole expression under considerations&Environment for the expression in the t functionu1Whether the current expression is inside a lambdavGCounting the number of occurrences of an expression in the environmentwLThe set of variables that are not allowed to occur in the chosen expressionCode motion interfaceTry to construct an . The first argument is the expression to be shared, and the second argument the expression in which it will be shared. This function can be used to transfer information (e.g. from static analysis) from the shared expression to the introduced variable.Try to type cast an expression. The first argument is the expression to cast. The second argument can be used to construct a witness to support the casting. The resulting expression (if any) should be equal to the first argument.AWhether a sub-expression can be hoisted over the given expression*Interface for injecting binding constructsInject a variableInject a lambdaInject a "let" symbolDefault  for domains of the form  (...      ...).Default  for domains of the form (... g info), where info$ can be used to witness type castingxZSubstituting a sub-expression. Assumes no variable capturing in the expressions involved.y3Count the number of occurrences of a sub-expressionzHChecks whether a sub-expression in a given environment can be lifted outt Choose a sub-expression to share?Perform common sub-expression elimination and variable hoistingr{s|uvwVariable constructor (e.g.  or )Lambda constructor (e.g.  or )WCan the expression represented by the first argument be shared in the second argument?"Can we hoist over this expression?!Construct a type equality witnessJConstruct info for a function, given info for the argument and the resultVariable constructorLambda constructorWCan the expression represented by the first argument be shared in the second argument?"Can we hoist over this expression?xSub-expression to be replacedReplacing sub-expressionWhole expressionyExpression to countExpression to count inzt} r{s|uvwxyzt}None!"+-./134579>CIKLN&Construction and elimination of tuples## None!"+-./134579>CIKLN Well-scoped !Wrap a symbol to give it a  signatureMapping from a symbol signature /Reader e a :-> Reader e b :-> Full (Reader e c)to a :-> b :-> Full cMapping from a symbol signature a :-> b :-> Full cto 5Reader env a :-> Reader env b :-> Full (Reader env c)Well-scoped variable bindingWell-scoped terms are introduced to be able to evaluate without type casting. The implementation is inspired by "Typing Dynamic Typing" (Baars and Swierstra, ICFP 2002,  (http://doi.acm.org/10.1145/581478.5814946) where expressions are represented as (essentially) ~ env a after "compilation". However, a major difference is that "Typing Dynamic Typing" starts from an untyped term, and thus needs (safe) dynamic type casting during compilation. In contrast, the denotational semantics of  (the ~! instance) uses no type casting.Environment extension&Remove the extension of an environment;Return the amount by which an environment has been extended!Lookup in an extended environment7Higher-order interface for well-scoped variable bindingFInspired by Conor McBride's "I am not a number, I am a classy hack" ( 0http://mazzo.li/epilogue/index.html%3Fp=773.html).$Evaluation of open well-scoped terms&Evaluation of closed well-scoped terms9Convert the representation of variables and binders from  to *. The latter is easier to analyze, has a K instance, etc.0Make a smart constructor for well-scoped terms.  has any type of the form: smartWS :: (sub :<: sup, bsym ~ (BindingWS :+: ReaderSym sup)) => sub (a :-> b :-> ... :-> Full x) -> ASTF bsym (Reader env a) -> ASTF bsym (Reader env b) -> ... -> ASTF bsym (Reader env x) None!"+-./134579>CIKLN None!"+-./134579>CIKLN None!"+-./134579>CIKLN%One-layer sugaring of monadic actions None!"+-./134579>CIKLN%One-layer sugaring of monadic actionsNone!"+-./134579>CIKLNNone!"+-./134579>CIKLNNone!"+-./134579>CIKLN Description of class methods rhs = lhs /MatchingMethod methodName mkClause extraClausesmkClause takes as arguments (1) a description of the constructor, (2) the constructor's index, (3) the constructor's name, and (4) its arity.'Get the name and arity of a constructor!General method for class deriving!General method for class derivingDerive  instance for a typeDerive N instance for a type kequal Con1 Con1 = True equal (Con2 a1 ... x1) (Con2 a2 ... x2) = and [a1==a2, ... x1==x2] equal _ _ = False dhash Con1 = hashInt 0 hash (Con2 a ... x) = foldr1 combine [hashInt 1, hash a, ... hash x] Derive K instance for a type trenderSym Con1 = "Con1" renderSym (Con2 a ... x) = concat ["(", unwords ["Con2", show a, ... show x], ")"] Instance contextType constructor nameClass head (e.g.  Render Con)Methods Class nameType constructor nameMethods Type name Type name Constructor name modifier Type name     !"#$%&'()*+,,-./0123456789:;<=>>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrsttuvwxyz{|}~                 !"#$%&&'  ()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyzrs{|}~     synta_KbNL5DBxNZN4nSkIn69VBKLanguage.Syntactic.SyntaxLanguage.Syntactic.Traversal!Language.Syntactic.InterpretationLanguage.Syntactic.SugarLanguage.Syntactic.DecorationLanguage.Syntactic.Functional%Language.Syntactic.Functional.Sharing#Language.Syntactic.Functional.Tuple(Language.Syntactic.Functional.WellScoped Language.Syntactic.Sugar.Binding%Language.Syntactic.Sugar.BindingTypedLanguage.Syntactic.Sugar.Monad#Language.Syntactic.Sugar.MonadTypedLanguage.Syntactic.Sugar.Tuple#Language.Syntactic.Sugar.TupleTypedLanguage.Syntactic.THLanguage.SyntacticNFData1rnf1TypedEFEEmpty:<:injProjectprj:+:InjLInjRSmartSymSmartSigSmartFunSymbolsymSig DenResult Signature signatureSigRepSigFullSigMore:->PartialFullresultASTFASTSym:$size smartSym'smartSym smartSymTypedliftEliftE2liftEFliftEF2injTcastExprsymTypeprjPWrapFull unwrapFullArgsNil:*gmapTgmapQ everywhereUpeverywhereDownuniverselistArgsmapArgsmapArgsAmapArgsM foldrArgsappArgsmatch simpleMatchfold simpleFoldlistFold matchTransmapASTtoTree StringTree stringTreeSymRender renderSym renderArgsEqualityequalhashrenderArgsSmartrender stringTreeshowASTdrawAST writeHtmlAST equalDefault hashDefault SyntacticNdesugarNsugarN SyntacticDomainInternaldesugarsugarresugarsugarSym sugarSymTyped$fSyntacticN(->)(->)$fSyntacticNffi$fSyntacticAST:&: decorExpr decorInfomapDecorgetDecor updateDecor liftDecor stripDecorstringTreeDecor showDecorWith drawDecorWithwriteHtmlDecorWith$fStringTree:&: $fRender:&: $fEquality:&:$fProjectsub:&: $fNFData1:&: $fSymbol:&:EvalEnv compileSymRunEnv DenotationMEvalevalSym DenotationAlphaEnvRemonunRemonMONADReturnBindLet BindingDomainprVarprLamBindingTVarTLamTBindingVarLamName ConstructLiteralmaxLam lam_templatelam fromDeBruijnmaxLamT lamT_templatelamTlamTyped desugarMonaddesugarMonadTypedfreeVarsallVarsalphaEq'alphaEqevalDenliftDenotationMcompileSymDefaultevalOpen evalClosedCodeMotionInterface Interface mkInjDict castExprCM hoistOverInjDict injVariable injLambdainjLetdefaultInterfacedefaultInterfaceDecor codeMotionTupleTup2Tup3Tup4Sel1Sel2Sel3Sel4Select4select4Select3select3Select2select2Select1select1$fEvalEnvTupleenv $fEvalTuple$fStringTreeTuple$fEqualityTuple $fRenderTuple $fSymbolTuple$fSelect4(,,,)$fSelect3(,,,)$fSelect2(,,,)$fSelect1(,,,) $fSelect3(,,) $fSelect2(,,) $fSelect1(,,) $fSelect2(,) $fSelect1(,)WS ReaderSym LowerReaderUnReader LiftReader BindingWSVarWSLamWSExtunextdifflookEnvlamWS evalOpenWS evalClosedWSfromWSsmartWS$fEvalReaderSym$fEvalBindingWS$fNFData1BindingWS$fSymbolBindingWS $fExtexte $fExtenvenv$fSyntactic(->) sugarMonad$fSyntacticRemon$fSyntactic(,,,)$fSyntactic(,,)$fSyntactic(,)Method DefaultMethodMatchingMethodconName deriveClassderiveClassSimple varSupply deriveSymbolderiveEquality deriveRenderdeeps_LbCWUlehDDeLxurARKDH5oControl.DeepSeqNFData$fProjectsubsupbaseGHC.BaseNothing$fProjectsubTyped $f:<:sym1:+: $f:<:sym1:+:0 $f:<:symsym $f:<:subAST$fProjectsym1:+:$fProjectsym1:+:0$fProjectsymsym$fProjectsubAST $fNFData1:+: $fSymbol:+:TFCo:R:SmartSym(->)TFCo:R:SmartSymASTTFCo:R:SmartSig(->)TFCo:R:SmartSigASTTFCo:R:SmartFunsym:->TFCo:R:SmartFunsymFull $fNFDataASTTFCo:R:DenResult:->TFCo:R:DenResultFull$fSignature:->$fSignatureFull $fFunctorASTconta_LKCPrTJwOTOLk4OU37YmeN Data.TreeTreeWrapAST unWrapASTString$fStringTreeTyped$fStringTreeEmpty$fStringTree:+: $fShowAST $fRenderTyped $fRenderEmpty $fRender:+:$fEqualityTyped$fEqualityEmpty$fEq:+: $fEquality:+:$fEqAST $fEqualityASTcompile$fEqualityBindingT$fEqualityBinding alphaEq'' alphaEq'''alphaEqChildren$fEvalEnvBindingT[]$fEvalEnvMONADenv$fEvalEnvLetenv$fEvalEnvConstructenv$fEvalEnvLiteralenv$fEvalEnv:&:env$fEvalEnvTypedenv$fEvalEnvEmptyenv$fEvalEnv:+:envTFCo:R:DenotationMm:->TFCo:R:DenotationMmFull $fEvalMONAD $fEvalLet$fEvalConstruct $fEvalLiteral $fEval:&: $fEvalEmpty $fEval:+:TFCo:R:Denotation:->TFCo:R:DenotationFull $fMonadRemon$fApplicativeRemon$fStringTreeMONAD$fEqualityMONAD $fRenderMONAD $fSymbolMONAD$fStringTreeLet $fEqualityLet $fRenderLet $fSymbolLet$fBindingDomainsym$fBindingDomainBindingT$fBindingDomainBinding$fBindingDomainAST$fBindingDomain:&:$fBindingDomainTyped$fBindingDomain:+:$fStringTreeBindingT$fRenderBindingT$fNFData1BindingT$fSymbolBindingT$fStringTreeBinding$fRenderBinding$fNFData1Binding$fSymbolBinding $fShowName$fStringTreeConstruct$fEqualityConstruct$fRenderConstruct$fSymbolConstruct$fStringTreeLiteral$fEqualityLiteral$fRenderLiteral$fSymbolLiteralChosenEnvchooseinLambdacounter dependencies substitutecountliftable codeMotionMtrans_3eG64VdP2vzGjP6wJiCp5XControl.Monad.Trans.ReaderReaderTFCo:R:LowerReader:->TFCo:R:LowerReaderFullTFCo:R:UnReaderReaderTTFCo:R:LiftReaderenv:->TFCo:R:LiftReaderenvFull