!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ None!"+-./123468=BHJKMExistential 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 supSymbol 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 domains 7Returns the symbol in the result of a smart constructor DMaps 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 Force a symbol to normal formReify 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)(%Constrain a symbol to a specific type)$Projection to a specific symbol typeIf sub is not in sup,  always returns .@  !"#$%&'()*  !"#$%&'()* ! " #$%&'()0   !"#$%&'()  None!"+-./123468=BHJKM*=Can be used to make an arbitrary type constructor indexed by ( a)7. This is useful as the type constructor parameter of -. That is, use Args (WrapFull c) ... instead of  Args c ...if c is not indexed by ( a).-List of symbol arguments0wMap a function over all immediate sub-terms (corresponds to the function with the same name in Scrap Your Boilerplate)1Map 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)2)Apply a transformation bottom-up over an  (corresponds to  everywhere in Scrap Your Boilerplate)3(Apply a transformation top-down over an  (corresponds to  everywhere' in Scrap Your Boilerplate)4#List all sub-terms (corresponds to universe in Uniplate)5Map a function over an -1 list and collect the results in an ordinary list6Map a function over an - list7$Map an applicative function over an - list8Map a monadic function over an - list9Right fold for an - list:>Apply a (partially applied) symbol to a list of argument terms;"Pattern match" on an S using a function that gets direct access to the top-most symbol and its sub-trees< A version of ; with a simpler result type=Fold an  using an -& list to hold the results of sub-terms>Simplified version of =B for situations where all intermediate results have the same type?Fold an . using a list to hold the results of sub-terms@ A version of ;O where the result is a transformed syntax tree, wrapped in a type constructor cAUpdate the symbols in an ASTB Convert an  to a *+,-./0123456789:;<=>?@AB*+,-./0123456789:;<=>?@AB10234-/.56789:?;<=>@A*+,B*+,-/.0123456789:;<=>?@AB. None!"+-./123468=BHJKMCConvert a symbol to a  of stringsDConvert a symbol to a  given a list of argument treesEQRender a symbol as concrete syntax. A complete instance must define at least the F method.FShow a symbol as a G2Render a symbol given a list of rendered argumentsHHigher-kinded equalityIHigher-kinded equality}Comparing elements of different types is often needed when dealing with expressions with existentially quantified sub-terms.J<Higher-kinded hashing. Elements that are equal according to I must result in the same hash:  equal a b ==> hash a == hash bKImplementation of G that handles infix operatorsL Render an  as concrete syntaxM Convert an  to a  of stringsN"Show a syntax tree using ASCII artO#Print a syntax tree using ASCII artP7Write a syntax tree to an HTML file with foldable nodesQDefault implementation of IRDefault implementation of JSDerive instances for H and CCDEFGHIJKLMNOPQRSCDEFGHIJKLMNOPQRSHIJEFGKLCDMNOPQRSCDEFGHIJKLMNOPQRSNone!"+-./123468=BHJKMTN-ary syntactic functionsU 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 V.WIt is usually assumed that (Z ([ a)) has the same meaning as a.\Syntactic type casting]"Sugared" symbol application] 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) TUVWXYZ[\]^_` TUVWXYZ[\] WXYZ[`\TUV_^]TUVWXYZ[\]^_`None!"+-./123468=BHJKM a=Decorating symbols or expressions with additional information One usage of aM is to decorate every node of a syntax tree. This is done simply by changing  AST sym sigto AST (sym :&: info) sigeMap over a decorationf(Get the decoration of the top-level nodeg+Update the decoration of the top-level nodehZLift a function that operates on expressions with associated information to operate on a aD expression. This function is convenient to use together with e.g. queryNodeSimple when the domain has the form (sym a info).iStrip decorations from an j#Rendering of decorated syntax treesk-Show an decorated syntax tree using ASCII artl.Print an decorated syntax tree using ASCII artabcdefghijklmnopq abcdefghijklabcdqponmefghijklabcdefghijklmnopq None!"+-./123468=BHJKMj  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]abcdefghijklNone!"+-./123468=BHJKM)r Well-scoped sWrap a symbol to give it a w signatureuMapping from a symbol signature /Reader e a :-> Reader e b :-> Full (Reader e c)to a :-> b :-> Full cwMapping from a symbol signature a :-> b :-> Full cto 5Reader env a :-> Reader env b :-> Full (Reader env c)xWell-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 x (the ! instance) uses no type casting.{Environment extension|&Remove the extension of an environment};Return the amount by which an environment has been extended~ EvaluationRuntime environment3Monadic 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 Mon using the W# instance provided in the modules Data.Syntactic.Sugar.Monad or Data.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).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.(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).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.1Higher-order interface for typed 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).'One-layer desugaring of monadic actionsAlpha-equivalence EvaluationLift a  to Simple implementation of  from a &"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.)!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 x to *. The latter is easier to analyze, has a E 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)I> does strict identifier comparison; i.e. no alpha equivalence.J} assigns the same hash to all variables and binders. This is a valid over-approximation that enables the following property:  a b ==> J a == J bI> does strict identifier comparison; i.e. no alpha equivalence.J} assigns the same hash to all variables and binders. This is a valid over-approximation that enables the following property:  a b ==> J a == J bprstuvwxyz{|}~     :rstuvwxyz{|}~:~{|}xzywvustr]rstuvwxzy{|}~     None!"+-./123468=BHJKMNone!"+-./123468=BHJKM None!"+-./123468=BHJKM%One-layer sugaring of monadic actions None!"+-./123468=BHJKM%One-layer sugaring of monadic actions     !"#$$%&'()*+,-./01233456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghiijklmnopqrstuvwxyzz{|}~       syntactic-2.1Data.Syntactic.SyntaxData.Syntactic.TraversalData.Syntactic.InterpretationData.Syntactic.SugarData.Syntactic.DecorationData.Syntactic.FunctionalData.Syntactic.Sugar.BindingData.Syntactic.Sugar.BindingTData.Syntactic.Sugar.MonadData.Syntactic.Sugar.MonadTData.SyntacticEFEEmpty:<:injProjectprj:+:InjRInjLSmartSymSmartSigSmartFunSymbolrnfSymsymSig DenResult Signature signatureSigRepSigMoreSigFull:->PartialFullresultASTFAST:$Symsize smartSym'smartSymliftEliftE2liftEFliftEF2symTypeprjPWrapFull unwrapFullArgs:*NilgmapTgmapQ everywhereUpeverywhereDownuniverselistArgsmapArgsmapArgsAmapArgsM foldrArgsappArgsmatch simpleMatchfold simpleFoldlistFold matchTransmapASTtoTree StringTree stringTreeSymRender renderSym renderArgsEqualityequalhashrenderArgsSmartrender stringTreeshowASTdrawAST writeHtmlAST equalDefault hashDefaultinterpretationInstances SyntacticNdesugarNsugarN SyntacticDomainInternaldesugarsugarresugarsugarSym$fSyntacticN(->)(->)$fSyntacticNffi$fSyntacticAST:&: decorExpr decorInfomapDecorgetDecor updateDecor liftDecor stripDecorstringTreeDecor showDecorWith drawDecorWith$fStringTree:&: $fRender:&: $fEquality:&:$fProjectsub:&: $fSymbol:&:WS ReaderSym LowerReaderUnReader LiftReader BindingWSLamWSVarWSExtunextdiffEvalEnv compileSymRunEnv DenotationMEvalevalSym DenotationAlphaEnvRemonunRemonMONADBindReturn BindingDomainprVarprLamBindingTLamTVarTBindingLamVarName ConstructmaxLamlam fromDeBruijnmaxLamTlamT desugarMonadalphaEq'alphaEqevalDenliftDenotationMcompileSymDefaultevalOpen evalClosedlookEnvlamWS evalOpenWS evalClosedWSfromWSsmartWS$fSyntactic(->) sugarMonad$fSyntacticRemon$fProjectsubsupbase Data.MaybeNothing $f:<:sym1:+: $f:<:sym1:+:0 $f:<:symsym $f:<:subAST$fProjectsym1:+:$fProjectsym1:+:0$fProjectsymsym$fProjectsubAST $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 $fFunctorASTcontainers-0.5.5.1 Data.TreeTreeWrapAST unWrapASTGHC.BaseString$fStringTreeEmpty$fStringTree:+: $fShowAST $fRenderEmpty $fRender:+:$fEqualityEmpty$fEq:+: $fEquality:+:$fEqAST $fEqualityASTtransformers-0.4.3.0Control.Monad.Trans.ReaderReadercompile$fEqualityBindingT$fEqualityBinding alphaEq'' alphaEq'''alphaEqChildren$fEvalReaderSymTFCo:R:LowerReader:->TFCo:R:LowerReaderFullTFCo:R:UnReaderReaderTTFCo:R:LiftReaderenv:->TFCo:R:LiftReaderenvFull$fEvalBindingWS$fSymbolBindingWS $fExtexte $fExtenvenv$fEvalEnvBindingT[]$fEvalEnvMONADenv$fEvalEnvConstructenv$fEvalEnv:&:env$fEvalEnvEmptyenv$fEvalEnv:+:envTFCo:R:DenotationMm:->TFCo:R:DenotationMmFull $fEvalMONAD$fEvalConstruct $fEval:&: $fEvalEmpty $fEval:+:TFCo:R:Denotation:->TFCo:R:DenotationFull $fMonadRemon$fApplicativeRemon$fStringTreeMONAD$fEqualityMONAD $fRenderMONAD $fSymbolMONAD$fBindingDomainsym$fBindingDomainBindingT$fBindingDomainBinding$fBindingDomainAST$fBindingDomain:&:$fBindingDomain:+:$fStringTreeBindingT$fRenderBindingT$fSymbolBindingT$fStringTreeBinding$fRenderBinding$fSymbolBinding $fShowName$fStringTreeConstruct$fEqualityConstruct$fRenderConstruct$fSymbolConstruct