=      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~portable experimentallibraries@haskell.orgportable experimentallibraries@haskell.orgThe string can have a , thus Foo.baz, , giving a dynamically-bound qualified name, + in which case we want to generate a NameQ $Parse the string to see if it has a . in it @ so we know whether to generate a qualified or unqualified name  It')s a bit tricky because we need to parse  " Foo.Baz.x as Qual Foo.Baz x "So we parse it from back to front  Only used internally yThe 3 constructor represents a list comprehension, and  takes a []1. The result expression of the comprehension is & the *last* of these, and should be a . E.g. translation:   [ f x | x <- xs ] D CompE [BindS (VarP x) (VarE xs), NoBindS (AppE (VarE f) (VarE x))] z{|Pattern in Haskell given in {} For global names (6!) we need a totally unique name, 0 so we must include the name-space of the thing For unique-numbered things (8), we've got a unique reference # anyway, so no need for name space For dynamically bound thing (:) we probably want them to , in a context-dependent way, so again we don't want the name  space. For example:  * let v = mkName "T" in [| data $v = $v |] IHere we use the same Name for both type constructor and data constructor 7NameL and NameG are bound *outside* the TH syntax tree 1 either globally (NameG) or locally (NameL). Ex:   f x = $(h [| (map, x) |]) The  will be a NameG, and x wil be a NameL JThese Names should never appear in a binding position in a TH syntax tree  k1 -> k2  (a :: k) a t :: k T a b [] -> (,), (,,), etc. T a forall  vars.  ctxt -> type forall a. Eq a => C [a] Int :+ a C { v :: Int, w :: a } C Int a  F a ~ Bool  Eq (Int, a)  (Eq a, Ord b) %{ type instance T (Maybe x) = (x,x) }  { newtype instance Cxt x => T [x] = A (B x)  deriving (Z,W)} { data instance Cxt x => T [x] = A x * | B (T x)  deriving (Z,W)} { type family T a b c :: * } { {- INLINE [1] foo -} } { length :: [a] -> Int } { instance Show w => Show [w]  where ds }  { class Eq a => Ord a where ds } { type T x = (x,x) } !{ newtype Cxt x => T x = A (B x)  deriving (Z,W)} ${ data Cxt x => T x = A x | B (T x)  deriving (Z,W)} { p = b where decs } { f p1 p2 = b where decs } f p { = e } where ds $f p { | e1 = e2 | e3 = e4 } where ds { (f x) { z = w } } { T { x = y, z = w } }  { e :: t } { [1,2,3] } { [ 1 ,2 .. 10 ] } { [ (x,y) | x <- xs, y <- ys ] }  { do { p < - e1; e2 } } { case e of m1; m2 } { let x=e1; y=e2 in e3 } { if e1 then e2 else e3 }  { (e1,e2) } {   p1 p2 -> e } %{x + y} or {(x+)} or {(+ x)} or {(+)}It'&s a bit gruesome to use an Exp as the + operator, but how else can we distinguish % constructors from non-constructors? * Maybe there should be a var-or-con type? 3 Or maybe we should leave it to the String itself?  { f x } { 5 or c} "data T1 = C1 t1 t2; p = {C1} e1 e2 { x } f { p1 p2 = body where decs } $case e of { pat -> body where decs }  { e -> p }  { p :: t } { [1,2,3] } f (Pt { pointx = x }) = g x { _ } { x @ p } { !p } { ~p } foo ({x :+ y}) = e "data T1 = C1 t1 t2; {C1 p1 p1} = e  { (p1,p2) } { x } { 5 or c }%A primitive C-style string, type Addr#     'Used for overloaded and non-overloaded  literals. We don't have a good way to & represent non-overloaded literals at  the moment. Maybe that doesn' t matter?  ' desribes a single instance of a class Obtained from H in the | Monad.  !"#'A class is reified to its declaration  and a list of its instances $%&'()*+,-./0120Type constructors and classes; Haskell has them ! in the same name space for now. 3Data constructors 4 Variables 56)Global name bound outside of the TH AST: 2 An original name (occurrences only, not binders) )Need the namespace too to be sure which  thing we are naming 7'Local name bound outside of the TH AST 8A unique local name 9$A qualified name; dynamically bound :'An unqualified name; dynamically bound ;<=> Fresh names ?*Report an error (True) or warning (False)  ...but carry on; use  to stop @the error handler action which may fail Recover from the monadic  ABCDInput/output (dangerous) EFGrecover with this one failing action HH looks up information about the ; II looks up instaces of a class JKK gives you the Location at which this  computation is spliced. LThe L function lets you run an I/O computation in the | monad. 8 Take care: you are guaranteed the ordering of calls to L within  a single |B computation, but not about the order in which splices are run. DNote: for various murky reasons, stdout and stderr handles are not G necesarily flushed when the compiler finishes running, so you should  flush them yourself. MNOPQRSBase, unqualified name. TUOnly used internally  Used for '+x etc, but not available to the programmer VWXData constructor YType constructor Z[YAlthough the NameFlavour type is abstract, the Data instance is not. The reason for this \ is that currently we use Data to serialize values in annotations, and in order for that to 4 work for Template Haskell names introduced via the '(x syntax we need gunfold on NameFlavour  to work. Bleh! ]The long term solution to this is to use the binary package for annotation serialization and d then remove this instance. However, to do _that_ we need to wait on binary to become stable, since ? boot libraries cannot be upgraded seperately from GHC itself. 9This instance cannot be derived automatically due to bug #2701  yz{|      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[=>?@ABCD<|EFGHKLJI;STVW,/.-yz{     #"! %&'()*+$[Z5:987614320 UYXQRMNOP yz{| ;           #"!  !"#$%&'()*+&'()*+,/.--./014322345:98766789:;<=>?@ABCD>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[  Use with ,  Use with > !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_defghijklmnopqrstuvwx}~\]^_`abcdefghi+Dynamically binding a variable (unhygenic) jkSingle-arg lambda lmnopqrs  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_defghijklmnopqrstuvwx}~\]^_`abcdefghijklmnopqrsa}~`_^]\  b^wx:;<=cdef98g\h]ij !"#$%&'(k)*+,-.l3456m7/012?>B@ACDEVlmpdqefgFjkIJKNOPQRTUSvHGLMrstuXWZ[Yno_ihnopqrs  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_defghijklmnopqrstuvwx}~\]^_`abcdefghijklmnopqrs `abctuvww converts a value to a 'Q Exp' representation of the same ; value. It takes a function to handle type-specific cases. xx converts a value to a 'Q Pat' representation of the same ; value. It takes a function to handle type-specific cases. yy takes a ut! and lifts it into one that read / the data out of a file. For example, suppose asmq is an C assembly-language quoter, so that you can write [asmq| ld r1, r2 |] & as an expression. Then if you define asmq_f = quoteFile asmq, then  the quote [asmq_f| foo.s |] will take input from file foo.s instead  of the inline text `abctuvwxy tu`acbvwxy `abctu`acbuvwxy0z{|}~Returns  if the document is empty An empty document A ';' character A ',' character A : character A space character A '=' character A '(' character A ')' character A '[' character A ']' character A '{' character A '}' character Wrap document in (...) Wrap document in [...] Wrap document in {...} Wrap document in '...' Wrap document in "..." Beside List version of  Beside, separated by space List version of  Above; if there is no  overlap it " dovetails" the two Above, without dovetailing. List version of  Either hcat or vcat Either hsep or vcat "Paragraph fill" version of cat "Paragraph fill" version of sep Nested  !hang d1 n d2 = sep [d1, nest n d2] punctuate p [d1, ... dn] = [d1 <> p, d2 <> p, ... dn-1 <> p, dn]-z{|}~-z{~|}-z{|}~""""7  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMOPQRSTUVWXYZ[\]^defghijklmnoqvwxyz{|}~      !"#%&'()*+EFGHIJKLSTXYZ[\]^_`abcdefghijklmr7|EFGHKLJISTYXyz{     #"! %&'()*+[Za}~`_^]\   b^wx98g\h]ij !"#$%&'(k)*+,r3456m7/012lcdef-.:;<=OPQRTUSvGHLMFjkIJK?>B@ACDEdqefghiWXYZ[Vnolm      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqqrstuvwxyz{|}~wtemplate-haskellLanguage.Haskell.TH.SyntaxLanguage.Haskell.TH.LibLanguage.Haskell.TH.Quote$Language.Haskell.TH.Syntax.InternalsLanguage.Haskell.TH.PprLibLanguage.Haskell.TH.PprLanguage.Haskell.THreturnQbindQ sequenceQliftnewNamemkName mkNameG_v mkNameG_d mkNameG_tcmkNameLcharLstringLintegerLintPrimL wordPrimL floatPrimL doublePrimL rationalL liftStringlitPvarPtupPconPtildePasPwildPrecPlistPsigPfieldPatmatchclausevarEconElitEappEinfixEinfixAppsectionLsectionRlamEtupEcondEletEcaseEdoEcompEfromE fromThenEfromToE fromThenToElistEsigErecConErecUpdEfieldExpguardedBnormalBbindSletSnoBindSparSfunDvalDdataDnewtypeDtySynDclassD instanceDsigDcxtisStrict notStrictnormalCrecCinfixC strictType varStrictTypeforallCforallTvarTconTappTtupleTarrowTlistTforImpDcCallstdCallunsafesafe threadsafenormalGEpatGEinfixPfunDepquoteExpquotePatquoteDec quoteType familyNoKindD dataInstD newtypeInstD tySynInstDtypeFamdataFamclassPequalPpragInlD pragSpecDinlineSpecNoPhaseinlineSpecPhase pragSpecInlD familyKindDplainTVkindedTVstarKarrowKsigTbangPviewPExpMatchClauseQExpQDecQPatMatchQClauseQStmtQConQTypeQTypeDecVarStrictTypeQ StrictTypeQFieldExpFieldPatNamePatQ FieldPatQ FieldExpQFunDepPredPredQ TyVarBndrDecsQOccNamePkgNameModNameKindArrowKStarKKindedTVPlainTVSigTAppTListTArrowTTupleTConTVarTForallT VarStrictType StrictTypeConForallCInfixCRecCNormalCStrict NotStrictIsStrictEqualPClassPCxt InlineSpecPragma SpecialisePInlinePSafety ThreadsafeSafeUnsafeCallconvStdCallCCallForeignExportFImportF FamFlavourDataFamTypeFam TySynInstD NewtypeInstD DataInstDFamilyDPragmaDForeignDSigD InstanceDClassDTySynDNewtypeDDataDValDFunDRange FromThenToRFromToR FromThenRFromRStmtParSNoBindSLetSBindSGuardPatGNormalGBodyNormalBGuardedBRecUpdERecConESigEListE ArithSeqECompEDoECaseELetECondETupELamEInfixEAppELitEConEVarEViewPSigPListPRecPWildPAsPBangPTildePInfixPConPTupPVarPLitPLit StringPrimL DoublePrimL FloatPrimL WordPrimLIntPrimL RationalLIntegerLStringLCharLFixityDirectionInfixNInfixRInfixLFixity ClassInstanceci_dfunci_tvsci_cxtci_clsci_tysInfoTyVarIVarIDataConI PrimTyConITyConIClassOpIClassICharPosLoc loc_filename loc_package loc_module loc_startloc_endNameIsInfixAppliedAloneUniq NameSpace TcClsNameDataNameVarName NameFlavourNameGNameLNameUNameQNameSLiftQuasiqNewNameqReportqRecoverqReifyqClassInstances qLocationqRunIOrunQreportrecoverreifyclassInstancesisClassInstancelocationrunIO mkModName modString mkPkgName pkgString mkOccName occStringnameBase nameModulemkNameUshowName showName' tupleDataName tupleTypeName maxPrecedence defaultFixity InlineSpecQRangeQGuardQBodyQCxtQInfoQ stringPrimLfromR fromThenRfromToR fromThenToRnormalGpatGdyngloballam1E arithSeqEstringEcombinerenamegenpatalphaappsE simpleMatch QuasiQuoterdataToQa dataToExpQ dataToPatQ quoteFileDocPprMpprNamepprName' to_HPJ_DocisEmptyemptysemicommacolonspaceequalslparenrparenlbrackrbracklbracerbracetextptextcharintintegerfloatdoublerationalparensbracketsbracesquotes doubleQuotes<>hcat<+>hsep$$$+$vcatcatsepfcatfsepnesthang punctuatePprpprppr_list Precedence nestDepthappPrecopPrecnoPrecparensIfpprintppr_sig pprFixity pprInfixExppprExp pprFields pprMaybeExppprBodypprLitpprPatppr_decppr_data ppr_newtype ppr_tySynppr_activationpprVarStrictType pprStrictType pprParendTypepprTyApp pprFunArgTypesplitpprArrowArgKindpprCxt where_clause showtextlbaseGHC.Base.mapGHC.Num*unQfailbadIOcountertrueName falseName nothingNamejustNameleftName rightName con_NameS con_NameQ con_NameU con_NameL con_NameGty_NameFlavourmkNameG mk_tup_namecmpEqthenCmp$fDataNameFlavourrunPprMStateghc-primGHC.BoolTrue