!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~portable experimentallibraries@haskell.orgNoneportable experimentallibraries@haskell.org Safe-Infered^The 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 |The 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))] Pattern in Haskell given in {} For global names (<!) we need a totally unique name, 0 so we must include the name-space of the thing For unique-numbered things (>), 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. (,), (,,), 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) %{ 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 ) }  { (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 ) }  { (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 N in the  Monad. )'A class is reified to its declaration  and a list of its instances 80Type constructors and classes; Haskell has them ! in the same name space for now. 9Data constructors : Variables <)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 ='Local name bound outside of the TH AST >A unique local name ?$A qualified name; dynamically bound @'An unqualified name; dynamically bound JInput/output (dangerous) NN looks up information about the  OO looks up instaces of a class QQ gives you the Location at which this  computation is spliced. RThe R function lets you run an I/O computation in the  monad. 8 Take care: you are guaranteed the ordering of calls to R 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. YBase, unqualified name. [Only used internally 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  |}~  (Eq a, Ord b)      !"#$%&'()*+,-./0123456789:;<=>?@ABCD Fresh names E*Report an error (True) or warning (False)  ...but carry on; use  to stop Fthe error handler action which may fail Recover from the monadic  GHIJKLMrecover with this one failing action NOPQRSTUVWXYZ[\]^Data constructor _Type constructor `Data constructor aType constructor bc |}~      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcCDEFGHIJBKLMNQRPOAYZ\]2543|}~      !")('&%$#+,-./01*cb;@?>=<7:986 [_^a`WXSTUVd |}~   A    !")('&%$#*+,-./01254367:98;@?>=<BCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abc Safe-Infered" Use with 1 # Use with E q+Dynamically binding a variable (unhygenic) sSingle-arg lambda  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwdefghijklmnopqrstuv  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwdefghijklmnopqrstuvihgfed  j !ABCDklmn>=o?p@"#qr$%&'()*+,s-./0123t89:;u<4567FEIGHJKLMNOPQRSTUVWX[\]^abchfgdeiYZ_`jklmnoprqstuvwv  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwdefghijklmnopqrstuv Safe-Inferedzz converts a value to a 'Q Exp' representation of the same ; value. It takes a function to handle type-specific cases. {{ converts a value to a 'Q Pat' representation of the same ; value. It takes a function to handle type-specific cases. || takes a w! 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 xyz{wxyz{| xyz{wxyz{| wxxy{zyz{|wxxy{zyz{| Safe-Infered 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]/}~-}~-}~/}~ Safe-Infered8$$6 Safe-Infered9  !"#$%&'()*+,-/0123456789:;<=>?@ABCDEFGHIJKLMNOQRSTUVWXYZ[\]_`abcdfghinopqstvw|}~      !"#$%&'()+,-./01KLMNOPQRYZ^_bcdefghijklmnopqrstuv9KLMNQRPOYZ_^|}~     ")('&%$# !+,-./01cbihgfed   j !>=o?p@"#qr$%&'()*+,s-/01v89:;u<4567tklmn23ABCDabchfgdiYZ_`VWX[\]FEIGHJKLQRSTUvwnopqMstNO      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'()**+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrsttuvwxyz{|}~template-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 liftStringlitPvarPtupP unboxedTupPconPinfixPtildePbangPasPwildPrecPlistPsigPviewPfieldPatmatchclausevarEconElitEappEinfixEinfixAppsectionLsectionRlamEtupE unboxedTupEcondEletEcaseEdoEcompEfromE fromThenEfromToE fromThenToElistEsigErecConErecUpdEfieldExpguardedBnormalBnormalGEpatGEbindSletSnoBindSparSfunDvalDdataDnewtypeDtySynDclassD instanceDsigDforImpDpragInlD pragSpecD pragSpecInlD familyNoKindD familyKindD dataInstD newtypeInstD tySynInstDcxtclassPequalPisStrict notStrictnormalCrecCinfixCforallC strictType varStrictTypeforallTvarTconTtupleT unboxedTupleTarrowTlistTappTsigTplainTVkindedTVstarKarrowKcCallstdCallunsafesafe interruptibleinlineSpecNoPhaseinlineSpecPhasefunDeptypeFamdataFamquoteExpquotePatquoteDec quoteTypeExpMatchClauseQExpQDecQPatMatchQClauseQStmtQConQTypeQTypeDecVarStrictTypeQ StrictTypeQFieldExpFieldPatNamePatQ FieldPatQ FieldExpQFunDepPredPredQ TyVarBndrDecsQOccNamePkgNameModNameKindArrowKStarKKindedTVPlainTVSigTAppTListTArrowT UnboxedTupleTTupleTConTVarTForallT VarStrictType StrictTypeConForallCInfixCRecCNormalCStrict NotStrictIsStrictEqualPClassPCxt InlineSpecPragma SpecialisePInlinePSafety InterruptibleSafeUnsafeCallconvStdCallCCallForeignExportFImportF FamFlavourDataFamTypeFam TySynInstD NewtypeInstD DataInstDFamilyDPragmaDForeignDSigD InstanceDClassDTySynDNewtypeDDataDValDFunDRange FromThenToRFromToR FromThenRFromRStmtParSNoBindSLetSBindSGuardPatGNormalGBodyNormalBGuardedBRecUpdERecConESigEListE ArithSeqECompEDoECaseELetECondE UnboxedTupETupELamEInfixEAppELitEConEVarEViewPSigPListPRecPWildPAsPBangPTildePInfixPConP UnboxedTupPTupPVarPLitPLit 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 tupleTypeNameunboxedTupleDataNameunboxedTupleTypeName maxPrecedence defaultFixity InlineSpecQRangeQGuardQBodyQCxtQInfoQ stringPrimLfromR fromThenRfromToR fromThenToRnormalGpatGdyngloballam1E arithSeqEstringEappsE QuasiQuoterdataToQa dataToExpQ dataToPatQ quoteFileDocPprMpprNamepprName' to_HPJ_DocisEmptyemptysemicommacolonspaceequalslparenrparenlbrackrbracklbracerbracetextptextcharintintegerfloatdoublerationalparensbracketsbracesquotes doubleQuotes<>hcat<+>hsep$$$+$vcatcatsepfcatfsepnesthang punctuatePprpprppr_list Precedence nestDepthappPrecopPrecnoPrecparensIfpprintppr_sig pprFixity pprInfixExppprExp pprFields pprMaybeExppprBodypprLit pprStringpprPatppr_decppr_data ppr_newtype ppr_tySynppr_activationpprVarStrictType pprStrictType pprParendTypepprTyApp pprFunArgTypesplitpprArrowArgKindpprCxt where_clause showtextl hashParensbaseGHC.Base.mapGHC.Num*$fDataNameFlavourfail $fShowName$fOrdNameFlavour$fEqNameFlavour $fOrdName$fEqName$fLift(,,,,,,) $fLift(,,,,,) $fLift(,,,,) $fLift(,,,) $fLift(,,) $fLift(,)$fLift[] $fLiftEither $fLiftMaybe $fLiftBool $fLiftChar $fLiftInt $fLiftInteger$fQuasiQ $fFunctorQ$fMonadQ $fQuasiIOghc-prim GHC.TypesTrue $fMonadPprM $fShowPprM $fPprRange $fPprPred $fPprKind$fPprTyVarBndr $fPprType$fPprCon $fPprClause $fPprPragma $fPprForeign$fPprFamFlavour $fPprFunDep$fPprDec$fPprPat $fPprMatch $fPprStmt$fPprExp$fPprClassInstance $fPprInfo $fPprName$fPpr[]