-- a Royal Pain (triggers other recompilation).
-----------------------------------------------------------------------------
+{-# OPTIONS -fwarn-unused-imports #-}
+-- The above warning supression flag is a temporary kludge.
+-- While working on this module you are encouraged to remove it and fix
+-- any warnings in the module. See
+-- http://hackage.haskell.org/trac/ghc/wiki/Commentary/CodingStyle#Warnings
+-- for details
+-- The kludge is only needed in this module because of trac #2267.
module DsMeta( dsBracket,
templateHaskellNames, qTyConName, nameTyConName,
- liftName, expQTyConName, decQTyConName, typeQTyConName,
- decTyConName, typeTyConName, mkNameG_dName, mkNameG_vName, mkNameG_tcName
+ liftName, expQTyConName, patQTyConName, decQTyConName, typeQTyConName,
+ decTyConName, typeTyConName, mkNameG_dName, mkNameG_vName, mkNameG_tcName,
+ quoteExpName, quotePatName
) where
#include "HsVersions.h"
import {-# SOURCE #-} DsExpr ( dsExpr )
import MatchLit
-import DsUtils
import DsMonad
import qualified Language.Haskell.TH as TH
-- OccName.varName we do this by removing varName from the import of
-- OccName above, making a qualified instance of OccName and using
-- OccNameAlias.varName where varName ws previously used in this file.
-import qualified OccName
+import qualified OccName( isDataOcc, isVarOcc, isTcOcc, varName, tcName )
import Module
import Id
-import Name
+import Name hiding( isVarOcc, isTcOcc, varName, tcName )
import NameEnv
import TcType
import TyCon
import TysWiredIn
import CoreSyn
+import MkCore
import CoreUtils
import SrcLoc
-import PackageConfig
import Unique
import BasicTypes
import Outputable
import Data.Maybe
import Control.Monad
import Data.List
-
+
-----------------------------------------------------------------------------
dsBracket :: HsBracket Name -> [PendingSplice] -> DsM CoreExpr
-- Returns a CoreExpr of type TH.ExpQ
-- Do *not* gensym top-level binders
}
+groupBinders :: HsGroup Name -> [Located Name]
groupBinders (HsGroup { hs_valds = val_decls, hs_tyclds = tycl_decls,
hs_fords = foreign_decls })
-- Collect the binders of a Group
ys_list <- coreList nameTyConName ys'
repFunDep xs_list ys_list
+repInstD' :: LInstDecl Name -> DsM (SrcSpan, Core TH.DecQ)
repInstD' (L loc (InstDecl ty binds _ _)) -- Ignore user pragmas for now
- = do { i <- addTyVarBinds tvs $ \tv_bndrs ->
+ = do { i <- addTyVarBinds tvs $ \_ ->
-- We must bring the type variables into scope, so their occurrences
-- don't fail, even though the binders don't appear in the resulting
-- data structure
repCCallConv :: CCallConv -> DsM (Core TH.Callconv)
repCCallConv CCallConv = rep2 cCallName []
repCCallConv StdCallConv = rep2 stdCallName []
+repCCallConv CmmCallConv = notHandled "repCCallConv" (ppr CmmCallConv)
repSafety :: Safety -> DsM (Core TH.Safety)
repSafety PlayRisky = rep2 unsafeName []
repSafety (PlaySafe False) = rep2 safeName []
repSafety (PlaySafe True) = rep2 threadsafeName []
-ds_msg = ptext SLIT("Cannot desugar this Template Haskell declaration:")
+ds_msg :: SDoc
+ds_msg = ptext (sLit "Cannot desugar this Template Haskell declaration:")
-------------------------------------------------------
-- Constructors
-------------------------------------------------------
repC :: LConDecl Name -> DsM (Core TH.ConQ)
-repC (L loc (ConDecl con expl [] (L _ []) details ResTyH98 _))
+repC (L _ (ConDecl con _ [] (L _ []) details ResTyH98 _))
= do { con1 <- lookupLOcc con ; -- See note [Binders and occurrences]
repConstr con1 details }
repC (L loc (ConDecl con expl tvs (L cloc ctxt) details ResTyH98 doc))
where
(str, ty') = case ty of
L _ (HsBangTy _ ty) -> (isStrictName, ty)
- other -> (notStrictName, ty)
+ _ -> (notStrictName, ty)
-------------------------------------------------------
-- Deriving clause
-- Singleton => Ok
-- Empty => Too hard, signature ignored
rep_sig (L loc (TypeSig nm ty)) = rep_proto nm ty loc
-rep_sig other = return []
+rep_sig _ = return []
rep_proto :: Located Name -> LHsType Name -> SrcSpan -> DsM [(SrcSpan, Core TH.DecQ)]
rep_proto nm ty loc = do { nm1 <- lookupLOcc nm ;
repTy (HsTyVar n)
| isTvOcc (nameOccName n) = do
- tv1 <- lookupBinder n
+ tv1 <- lookupTvOcc n
repTvar tv1
| otherwise = do
tc1 <- lookupOcc n
t1 <- repLTy t
tcon <- repTy (HsTyVar (tyConName parrTyCon))
repTapp tcon t1
-repTy (HsTupleTy tc tys) = do
+repTy (HsTupleTy _ tys) = do
tys1 <- repLTys tys
tcon <- repTupleTyCon (length tys)
repTapps tcon tys1
Just (Bound y) -> repVarOrCon x (coreVar y)
Just (Splice e) -> do { e' <- dsExpr e
; return (MkC e') } }
-repE e@(HsIPVar x) = notHandled "Implicit parameters" (ppr e)
+repE e@(HsIPVar _) = notHandled "Implicit parameters" (ppr e)
-- Remember, we're desugaring renamer output here, so
-- HsOverlit can definitely occur
repE (HsLam (MatchGroup [m] _)) = repLambda m
repE (HsApp x y) = do {a <- repLE x; b <- repLE y; repApp a b}
-repE (OpApp e1 op fix e2) =
+repE (OpApp e1 op _ e2) =
do { arg1 <- repLE e1;
arg2 <- repLE e2;
the_op <- repLE op ;
repInfixApp arg1 the_op arg2 }
-repE (NegApp x nm) = do
+repE (NegApp x _) = do
a <- repLE x
negateVar <- lookupOcc negateName >>= repVar
negateVar `repApp` a
; z <- repLetE ds e2
; wrapGenSyns ss z }
-- FIXME: I haven't got the types here right yet
-repE (HsDo DoExpr sts body ty)
+repE (HsDo DoExpr sts body _)
= do { (ss,zs) <- repLSts sts;
body' <- addBinds ss $ repLE body;
ret <- repNoBindSt body';
e <- repDoE (nonEmptyCoreList (zs ++ [ret]));
wrapGenSyns ss e }
-repE (HsDo ListComp sts body ty)
+repE (HsDo ListComp sts body _)
= do { (ss,zs) <- repLSts sts;
body' <- addBinds ss $ repLE body;
ret <- repNoBindSt body';
e <- repComp (nonEmptyCoreList (zs ++ [ret]));
wrapGenSyns ss e }
repE e@(HsDo _ _ _ _) = notHandled "mdo and [: :]" (ppr e)
-repE (ExplicitList ty es) = do { xs <- repLEs es; repListExp xs }
-repE e@(ExplicitPArr ty es) = notHandled "Parallel arrays" (ppr e)
+repE (ExplicitList _ es) = do { xs <- repLEs es; repListExp xs }
+repE e@(ExplicitPArr _ _) = notHandled "Parallel arrays" (ppr e)
repE e@(ExplicitTuple es boxed)
| isBoxed boxed = do { xs <- repLEs es; repTup xs }
| otherwise = notHandled "Unboxed tuples" (ppr e)
-repE (RecordCon c _ (HsRecordBinds flds))
+repE (RecordCon c _ flds)
= do { x <- lookupLOcc c;
fs <- repFields flds;
repRecCon x fs }
-repE (RecordUpd e (HsRecordBinds flds) _ _)
+repE (RecordUpd e flds _ _ _)
= do { x <- repLE e;
fs <- repFields flds;
repRecUpd x fs }
; case mb_val of
Just (Splice e) -> do { e' <- dsExpr e
; return (MkC e') }
- other -> pprPanic "HsSplice" (ppr n) }
+ _ -> pprPanic "HsSplice" (ppr n) }
-- Should not happen; statically checked
repE e@(PArrSeq {}) = notHandled "Parallel arrays" (ppr e)
-- Building representations of auxillary structures like Match, Clause, Stmt,
repMatchTup :: LMatch Name -> DsM (Core TH.MatchQ)
-repMatchTup (L _ (Match [p] ty (GRHSs guards wheres))) =
+repMatchTup (L _ (Match [p] _ (GRHSs guards wheres))) =
do { ss1 <- mkGenSyms (collectPatBinders p)
; addBinds ss1 $ do {
; p1 <- repLP p
; gs <- repGuards guards
; match <- repMatch p1 gs ds
; wrapGenSyns (ss1++ss2) match }}}
-repMatchTup other = panic "repMatchTup: case alt with more than one arg"
+repMatchTup _ = panic "repMatchTup: case alt with more than one arg"
repClauseTup :: LMatch Name -> DsM (Core TH.ClauseQ)
-repClauseTup (L _ (Match ps ty (GRHSs guards wheres))) =
+repClauseTup (L _ (Match ps _ (GRHSs guards wheres))) =
do { ss1 <- mkGenSyms (collectPatsBinders ps)
; addBinds ss1 $ do {
ps1 <- repLPs ps
g <- repPatGE (nonEmptyCoreList ss') rhs'
return (gs, g)
-repFields :: [(Located Name, LHsExpr Name)] -> DsM (Core [TH.Q TH.FieldExp])
-repFields flds = do
- fnames <- mapM lookupLOcc (map fst flds)
- es <- mapM repLE (map snd flds)
- fs <- zipWithM repFieldExp fnames es
- coreList fieldExpQTyConName fs
+repFields :: HsRecordBinds Name -> DsM (Core [TH.Q TH.FieldExp])
+repFields (HsRecFields { rec_flds = flds })
+ = do { fnames <- mapM lookupLOcc (map hsRecFieldId flds)
+ ; es <- mapM repLE (map hsRecFieldArg flds)
+ ; fs <- zipWithM repFieldExp fnames es
+ ; coreList fieldExpQTyConName fs }
-----------------------------------------------------------------------------
= do { core1 <- rep_binds' (unionManyBags (map snd binds))
; core2 <- rep_sigs' sigs
; return (core1 ++ core2) }
-rep_val_binds (ValBindsIn binds sigs)
+rep_val_binds (ValBindsIn _ _)
= panic "rep_val_binds: ValBindsIn"
rep_binds :: LHsBinds Name -> DsM [Core TH.DecQ]
-- e.g. x = g 5 as a Fun MonoBinds. This is indicated by a single match
-- with an empty list of patterns
rep_bind (L loc (FunBind { fun_id = fn,
- fun_matches = MatchGroup [L _ (Match [] ty (GRHSs guards wheres))] _ }))
+ fun_matches = MatchGroup [L _ (Match [] _ (GRHSs guards wheres))] _ }))
= do { (ss,wherecore) <- repBinds wheres
; guardcore <- addBinds ss (repGuards guards)
; fn' <- lookupLBinder fn
; ans' <- wrapGenSyns ss ans
; return (loc, ans') }
-rep_bind (L loc (VarBind { var_id = v, var_rhs = e}))
+rep_bind (L _ (VarBind { var_id = v, var_rhs = e}))
= do { v' <- lookupBinder v
; e2 <- repLE e
; x <- repNormal e2
; ans <- repVal patcore x empty_decls
; return (srcLocSpan (getSrcLoc v), ans) }
-rep_bind other = panic "rep_bind: AbsBinds"
+rep_bind (L _ (AbsBinds {})) = panic "rep_bind: AbsBinds"
-----------------------------------------------------------------------------
-- Since everything in a Bind is mutually recursive we need rename all
do { xs <- repLPs ps; body <- repLE e; repLam xs body })
; wrapGenSyns ss lam }
-repLambda (L _ m) = notHandled "Guarded labmdas" (pprMatch LambdaExpr m)
+repLambda (L _ m) = notHandled "Guarded labmdas" (pprMatch (LambdaExpr :: HsMatchContext Name) m)
-----------------------------------------------------------------------------
repP (ConPatIn dc details)
= do { con_str <- lookupLOcc dc
; case details of
- PrefixCon ps -> do { qs <- repLPs ps; repPcon con_str qs }
- RecCon pairs -> do { vs <- sequence $ map lookupLOcc (map hsRecFieldId pairs)
- ; ps <- sequence $ map repLP (map hsRecFieldArg pairs)
+ PrefixCon ps -> do { qs <- repLPs ps; repPcon con_str qs }
+ RecCon rec -> do { let flds = rec_flds rec
+ ; vs <- sequence $ map lookupLOcc (map hsRecFieldId flds)
+ ; ps <- sequence $ map repLP (map hsRecFieldArg flds)
; fps <- zipWithM (\x y -> rep2 fieldPatName [unC x,unC y]) vs ps
; fps' <- coreList fieldPatQTyConName fps
; repPrec con_str fps' }
p2' <- repLP p2;
repPinfix p1' con_str p2' }
}
-repP (NPat l Nothing _ _) = do { a <- repOverloadedLiteral l; repPlit a }
-repP p@(NPat l (Just _) _ _) = notHandled "Negative overloaded patterns" (ppr p)
+repP (NPat l Nothing _) = do { a <- repOverloadedLiteral l; repPlit a }
+repP p@(NPat _ (Just _) _) = notHandled "Negative overloaded patterns" (ppr p)
repP p@(SigPatIn {}) = notHandled "Type signatures in patterns" (ppr p)
-- The problem is to do with scoped type variables.
-- To implement them, we have to implement the scoping rules
= do { mb_val <- dsLookupMetaEnv n;
case mb_val of
Just (Bound x) -> return (coreVar x)
- other -> failWithDs msg }
+ _ -> failWithDs msg }
where
- msg = ptext SLIT("DsMeta: failed binder lookup when desugaring a TH bracket:") <+> ppr n
+ msg = ptext (sLit "DsMeta: failed binder lookup when desugaring a TH bracket:") <+> ppr n
-- Look up a name that is either locally bound or a global name
--
Just (Splice _) -> pprPanic "repE:lookupOcc" (ppr n)
}
+lookupTvOcc :: Name -> DsM (Core TH.Name)
+-- Type variables can't be staged and are not lexically scoped in TH
+lookupTvOcc n
+ = do { mb_val <- dsLookupMetaEnv n ;
+ case mb_val of
+ Just (Bound x) -> return (coreVar x)
+ _ -> failWithDs msg
+ }
+ where
+ msg = vcat [ ptext (sLit "Illegal lexically-scoped type variable") <+> quotes (ppr n)
+ , ptext (sLit "Lexically scoped type variables are not supported by Template Haskell") ]
+
globalVar :: Name -> DsM (Core TH.Name)
-- Not bound by the meta-env
-- Could be top-level; or could be local
; MkC uni <- coreIntLit (getKey (getUnique name))
; rep2 mkNameLName [occ,uni] }
where
- mod = nameModule name
+ mod = ASSERT( isExternalName name) nameModule name
name_mod = moduleNameString (moduleName mod)
name_pkg = packageIdString (modulePackageId mod)
name_occ = nameOccName name
-- argument type. NB: this relies on Q being a data/newtype,
-- not a type synonym
- go var_ty [] = return body
+ go _ [] = return body
go var_ty ((name,id) : binds)
= do { MkC body' <- go var_ty binds
; lit_str <- occNameLit name
-- we invent a new datatype which uses phantom types.
newtype Core a = MkC CoreExpr
+unC :: Core a -> CoreExpr
unC (MkC x) = x
rep2 :: Name -> [ CoreExpr ] -> DsM (Core a)
repCtxt :: Core [TH.TypeQ] -> DsM (Core TH.CxtQ)
repCtxt (MkC tys) = rep2 cxtName [tys]
-repConstr :: Core TH.Name -> HsConDetails Name (LBangType Name)
+repConstr :: Core TH.Name -> HsConDeclDetails Name
-> DsM (Core TH.ConQ)
repConstr con (PrefixCon ps)
= do arg_tys <- mapM repBangTy ps
arg_tys1 <- coreList strictTypeQTyConName arg_tys
rep2 normalCName [unC con, unC arg_tys1]
repConstr con (RecCon ips)
- = do arg_vs <- mapM lookupLOcc (map hsRecFieldId ips)
- arg_tys <- mapM repBangTy (map hsRecFieldArg ips)
+ = do arg_vs <- mapM lookupLOcc (map cd_fld_name ips)
+ arg_tys <- mapM repBangTy (map cd_fld_type ips)
arg_vtys <- zipWithM (\x y -> rep2 varStrictTypeName [unC x, unC y])
arg_vs arg_tys
arg_vtys' <- coreList varStrictTypeQTyConName arg_vtys
repTupleTyCon :: Int -> DsM (Core TH.TypeQ)
-- Note: not Core Int; it's easier to be direct here
-repTupleTyCon i = rep2 tupleTName [mkIntExpr (fromIntegral i)]
+repTupleTyCon i = rep2 tupleTName [mkIntExprInt i]
repArrowTyCon :: DsM (Core TH.TypeQ)
repArrowTyCon = rep2 arrowTName []
repLiteral lit
= do lit' <- case lit of
HsIntPrim i -> mk_integer i
+ HsWordPrim w -> mk_integer w
HsInt i -> mk_integer i
HsFloatPrim r -> mk_rational r
HsDoublePrim r -> mk_rational r
HsInteger _ _ -> Just integerLName
HsInt _ -> Just integerLName
HsIntPrim _ -> Just intPrimLName
+ HsWordPrim _ -> Just wordPrimLName
HsFloatPrim _ -> Just floatPrimLName
HsDoublePrim _ -> Just doublePrimLName
HsChar _ -> Just charLName
HsString _ -> Just stringLName
HsRat _ _ -> Just rationalLName
- other -> Nothing
+ _ -> Nothing
+mk_integer :: Integer -> DsM HsLit
mk_integer i = do integer_ty <- lookupType integerTyConName
return $ HsInteger i integer_ty
+mk_rational :: Rational -> DsM HsLit
mk_rational r = do rat_ty <- lookupType rationalTyConName
return $ HsRat r rat_ty
-mk_string s = do string_ty <- lookupType stringTyConName
- return $ HsString s
+mk_string :: FastString -> DsM HsLit
+mk_string s = return $ HsString s
repOverloadedLiteral :: HsOverLit Name -> DsM (Core TH.Lit)
-repOverloadedLiteral (HsIntegral i _) = do { lit <- mk_integer i; repLiteral lit }
-repOverloadedLiteral (HsFractional f _) = do { lit <- mk_rational f; repLiteral lit }
-repOverloadedLiteral (HsIsString s _) = do { lit <- mk_string s; repLiteral lit }
+repOverloadedLiteral (OverLit { ol_val = val})
+ = do { lit <- mk_lit val; repLiteral lit }
-- The type Rational will be in the environment, becuase
-- the smart constructor 'TH.Syntax.rationalL' uses it in its type,
-- and rationalL is sucked in when any TH stuff is used
+
+mk_lit :: OverLitVal -> DsM HsLit
+mk_lit (HsIntegral i) = mk_integer i
+mk_lit (HsFractional f) = mk_rational f
+mk_lit (HsIsString s) = mk_string s
--------------- Miscellaneous -------------------
nonEmptyCoreList [] = panic "coreList: empty argument"
nonEmptyCoreList xs@(MkC x:_) = MkC (mkListExpr (exprType x) (map unC xs))
-corePair :: (Core a, Core b) -> Core (a,b)
-corePair (MkC x, MkC y) = MkC (mkCoreTup [x,y])
-
coreStringLit :: String -> DsM (Core String)
coreStringLit s = do { z <- mkStringExpr s; return(MkC z) }
coreIntLit :: Int -> DsM (Core Int)
-coreIntLit i = return (MkC (mkIntExpr (fromIntegral i)))
+coreIntLit i = return (MkC (mkIntExprInt i))
coreVar :: Id -> Core TH.Name -- The Id has type Name
coreVar id = MkC (Var id)
notHandled :: String -> SDoc -> DsM a
notHandled what doc = failWithDs msg
where
- msg = hang (text what <+> ptext SLIT("not (yet) handled by Template Haskell"))
+ msg = hang (text what <+> ptext (sLit "not (yet) handled by Template Haskell"))
2 doc
mkNameName, mkNameG_vName, mkNameG_dName, mkNameG_tcName, mkNameLName,
-- Lit
- charLName, stringLName, integerLName, intPrimLName,
+ charLName, stringLName, integerLName, intPrimLName, wordPrimLName,
floatPrimLName, doublePrimLName, rationalLName,
-- Pat
litPName, varPName, tupPName, conPName, tildePName, infixPName,
decQTyConName, conQTyConName, strictTypeQTyConName,
varStrictTypeQTyConName, typeQTyConName, expTyConName, decTyConName,
typeTyConName, matchTyConName, clauseTyConName, patQTyConName,
- fieldPatQTyConName, fieldExpQTyConName, funDepTyConName]
+ fieldPatQTyConName, fieldExpQTyConName, funDepTyConName,
-thSyn :: Module
-thSyn = mkTHModule FSLIT("Language.Haskell.TH.Syntax")
-thLib = mkTHModule FSLIT("Language.Haskell.TH.Lib")
+ -- Quasiquoting
+ quoteExpName, quotePatName]
+thSyn, thLib, qqLib :: Module
+thSyn = mkTHModule (fsLit "Language.Haskell.TH.Syntax")
+thLib = mkTHModule (fsLit "Language.Haskell.TH.Lib")
+qqLib = mkTHModule (fsLit "Language.Haskell.TH.Quote")
+
+mkTHModule :: FastString -> Module
mkTHModule m = mkModule thPackageId (mkModuleNameFS m)
+libFun, libTc, thFun, thTc, qqFun :: FastString -> Unique -> Name
libFun = mk_known_key_name OccName.varName thLib
libTc = mk_known_key_name OccName.tcName thLib
thFun = mk_known_key_name OccName.varName thSyn
thTc = mk_known_key_name OccName.tcName thSyn
+qqFun = mk_known_key_name OccName.varName qqLib
-------------------- TH.Syntax -----------------------
-qTyConName = thTc FSLIT("Q") qTyConKey
-nameTyConName = thTc FSLIT("Name") nameTyConKey
-fieldExpTyConName = thTc FSLIT("FieldExp") fieldExpTyConKey
-patTyConName = thTc FSLIT("Pat") patTyConKey
-fieldPatTyConName = thTc FSLIT("FieldPat") fieldPatTyConKey
-expTyConName = thTc FSLIT("Exp") expTyConKey
-decTyConName = thTc FSLIT("Dec") decTyConKey
-typeTyConName = thTc FSLIT("Type") typeTyConKey
-matchTyConName = thTc FSLIT("Match") matchTyConKey
-clauseTyConName = thTc FSLIT("Clause") clauseTyConKey
-funDepTyConName = thTc FSLIT("FunDep") funDepTyConKey
-
-returnQName = thFun FSLIT("returnQ") returnQIdKey
-bindQName = thFun FSLIT("bindQ") bindQIdKey
-sequenceQName = thFun FSLIT("sequenceQ") sequenceQIdKey
-newNameName = thFun FSLIT("newName") newNameIdKey
-liftName = thFun FSLIT("lift") liftIdKey
-mkNameName = thFun FSLIT("mkName") mkNameIdKey
-mkNameG_vName = thFun FSLIT("mkNameG_v") mkNameG_vIdKey
-mkNameG_dName = thFun FSLIT("mkNameG_d") mkNameG_dIdKey
-mkNameG_tcName = thFun FSLIT("mkNameG_tc") mkNameG_tcIdKey
-mkNameLName = thFun FSLIT("mkNameL") mkNameLIdKey
+qTyConName, nameTyConName, fieldExpTyConName, patTyConName,
+ fieldPatTyConName, expTyConName, decTyConName, typeTyConName,
+ matchTyConName, clauseTyConName, funDepTyConName :: Name
+qTyConName = thTc (fsLit "Q") qTyConKey
+nameTyConName = thTc (fsLit "Name") nameTyConKey
+fieldExpTyConName = thTc (fsLit "FieldExp") fieldExpTyConKey
+patTyConName = thTc (fsLit "Pat") patTyConKey
+fieldPatTyConName = thTc (fsLit "FieldPat") fieldPatTyConKey
+expTyConName = thTc (fsLit "Exp") expTyConKey
+decTyConName = thTc (fsLit "Dec") decTyConKey
+typeTyConName = thTc (fsLit "Type") typeTyConKey
+matchTyConName = thTc (fsLit "Match") matchTyConKey
+clauseTyConName = thTc (fsLit "Clause") clauseTyConKey
+funDepTyConName = thTc (fsLit "FunDep") funDepTyConKey
+
+returnQName, bindQName, sequenceQName, newNameName, liftName,
+ mkNameName, mkNameG_vName, mkNameG_dName, mkNameG_tcName,
+ mkNameLName :: Name
+returnQName = thFun (fsLit "returnQ") returnQIdKey
+bindQName = thFun (fsLit "bindQ") bindQIdKey
+sequenceQName = thFun (fsLit "sequenceQ") sequenceQIdKey
+newNameName = thFun (fsLit "newName") newNameIdKey
+liftName = thFun (fsLit "lift") liftIdKey
+mkNameName = thFun (fsLit "mkName") mkNameIdKey
+mkNameG_vName = thFun (fsLit "mkNameG_v") mkNameG_vIdKey
+mkNameG_dName = thFun (fsLit "mkNameG_d") mkNameG_dIdKey
+mkNameG_tcName = thFun (fsLit "mkNameG_tc") mkNameG_tcIdKey
+mkNameLName = thFun (fsLit "mkNameL") mkNameLIdKey
-------------------- TH.Lib -----------------------
-- data Lit = ...
-charLName = libFun FSLIT("charL") charLIdKey
-stringLName = libFun FSLIT("stringL") stringLIdKey
-integerLName = libFun FSLIT("integerL") integerLIdKey
-intPrimLName = libFun FSLIT("intPrimL") intPrimLIdKey
-floatPrimLName = libFun FSLIT("floatPrimL") floatPrimLIdKey
-doublePrimLName = libFun FSLIT("doublePrimL") doublePrimLIdKey
-rationalLName = libFun FSLIT("rationalL") rationalLIdKey
+charLName, stringLName, integerLName, intPrimLName, wordPrimLName,
+ floatPrimLName, doublePrimLName, rationalLName :: Name
+charLName = libFun (fsLit "charL") charLIdKey
+stringLName = libFun (fsLit "stringL") stringLIdKey
+integerLName = libFun (fsLit "integerL") integerLIdKey
+intPrimLName = libFun (fsLit "intPrimL") intPrimLIdKey
+wordPrimLName = libFun (fsLit "wordPrimL") wordPrimLIdKey
+floatPrimLName = libFun (fsLit "floatPrimL") floatPrimLIdKey
+doublePrimLName = libFun (fsLit "doublePrimL") doublePrimLIdKey
+rationalLName = libFun (fsLit "rationalL") rationalLIdKey
-- data Pat = ...
-litPName = libFun FSLIT("litP") litPIdKey
-varPName = libFun FSLIT("varP") varPIdKey
-tupPName = libFun FSLIT("tupP") tupPIdKey
-conPName = libFun FSLIT("conP") conPIdKey
-infixPName = libFun FSLIT("infixP") infixPIdKey
-tildePName = libFun FSLIT("tildeP") tildePIdKey
-asPName = libFun FSLIT("asP") asPIdKey
-wildPName = libFun FSLIT("wildP") wildPIdKey
-recPName = libFun FSLIT("recP") recPIdKey
-listPName = libFun FSLIT("listP") listPIdKey
-sigPName = libFun FSLIT("sigP") sigPIdKey
+litPName, varPName, tupPName, conPName, infixPName, tildePName,
+ asPName, wildPName, recPName, listPName, sigPName :: Name
+litPName = libFun (fsLit "litP") litPIdKey
+varPName = libFun (fsLit "varP") varPIdKey
+tupPName = libFun (fsLit "tupP") tupPIdKey
+conPName = libFun (fsLit "conP") conPIdKey
+infixPName = libFun (fsLit "infixP") infixPIdKey
+tildePName = libFun (fsLit "tildeP") tildePIdKey
+asPName = libFun (fsLit "asP") asPIdKey
+wildPName = libFun (fsLit "wildP") wildPIdKey
+recPName = libFun (fsLit "recP") recPIdKey
+listPName = libFun (fsLit "listP") listPIdKey
+sigPName = libFun (fsLit "sigP") sigPIdKey
-- type FieldPat = ...
-fieldPatName = libFun FSLIT("fieldPat") fieldPatIdKey
+fieldPatName :: Name
+fieldPatName = libFun (fsLit "fieldPat") fieldPatIdKey
-- data Match = ...
-matchName = libFun FSLIT("match") matchIdKey
+matchName :: Name
+matchName = libFun (fsLit "match") matchIdKey
--- data Clause = ...
-clauseName = libFun FSLIT("clause") clauseIdKey
+-- data Clause = ...
+clauseName :: Name
+clauseName = libFun (fsLit "clause") clauseIdKey
-- data Exp = ...
-varEName = libFun FSLIT("varE") varEIdKey
-conEName = libFun FSLIT("conE") conEIdKey
-litEName = libFun FSLIT("litE") litEIdKey
-appEName = libFun FSLIT("appE") appEIdKey
-infixEName = libFun FSLIT("infixE") infixEIdKey
-infixAppName = libFun FSLIT("infixApp") infixAppIdKey
-sectionLName = libFun FSLIT("sectionL") sectionLIdKey
-sectionRName = libFun FSLIT("sectionR") sectionRIdKey
-lamEName = libFun FSLIT("lamE") lamEIdKey
-tupEName = libFun FSLIT("tupE") tupEIdKey
-condEName = libFun FSLIT("condE") condEIdKey
-letEName = libFun FSLIT("letE") letEIdKey
-caseEName = libFun FSLIT("caseE") caseEIdKey
-doEName = libFun FSLIT("doE") doEIdKey
-compEName = libFun FSLIT("compE") compEIdKey
+varEName, conEName, litEName, appEName, infixEName, infixAppName,
+ sectionLName, sectionRName, lamEName, tupEName, condEName,
+ letEName, caseEName, doEName, compEName :: Name
+varEName = libFun (fsLit "varE") varEIdKey
+conEName = libFun (fsLit "conE") conEIdKey
+litEName = libFun (fsLit "litE") litEIdKey
+appEName = libFun (fsLit "appE") appEIdKey
+infixEName = libFun (fsLit "infixE") infixEIdKey
+infixAppName = libFun (fsLit "infixApp") infixAppIdKey
+sectionLName = libFun (fsLit "sectionL") sectionLIdKey
+sectionRName = libFun (fsLit "sectionR") sectionRIdKey
+lamEName = libFun (fsLit "lamE") lamEIdKey
+tupEName = libFun (fsLit "tupE") tupEIdKey
+condEName = libFun (fsLit "condE") condEIdKey
+letEName = libFun (fsLit "letE") letEIdKey
+caseEName = libFun (fsLit "caseE") caseEIdKey
+doEName = libFun (fsLit "doE") doEIdKey
+compEName = libFun (fsLit "compE") compEIdKey
-- ArithSeq skips a level
-fromEName = libFun FSLIT("fromE") fromEIdKey
-fromThenEName = libFun FSLIT("fromThenE") fromThenEIdKey
-fromToEName = libFun FSLIT("fromToE") fromToEIdKey
-fromThenToEName = libFun FSLIT("fromThenToE") fromThenToEIdKey
+fromEName, fromThenEName, fromToEName, fromThenToEName :: Name
+fromEName = libFun (fsLit "fromE") fromEIdKey
+fromThenEName = libFun (fsLit "fromThenE") fromThenEIdKey
+fromToEName = libFun (fsLit "fromToE") fromToEIdKey
+fromThenToEName = libFun (fsLit "fromThenToE") fromThenToEIdKey
-- end ArithSeq
-listEName = libFun FSLIT("listE") listEIdKey
-sigEName = libFun FSLIT("sigE") sigEIdKey
-recConEName = libFun FSLIT("recConE") recConEIdKey
-recUpdEName = libFun FSLIT("recUpdE") recUpdEIdKey
+listEName, sigEName, recConEName, recUpdEName :: Name
+listEName = libFun (fsLit "listE") listEIdKey
+sigEName = libFun (fsLit "sigE") sigEIdKey
+recConEName = libFun (fsLit "recConE") recConEIdKey
+recUpdEName = libFun (fsLit "recUpdE") recUpdEIdKey
-- type FieldExp = ...
-fieldExpName = libFun FSLIT("fieldExp") fieldExpIdKey
+fieldExpName :: Name
+fieldExpName = libFun (fsLit "fieldExp") fieldExpIdKey
-- data Body = ...
-guardedBName = libFun FSLIT("guardedB") guardedBIdKey
-normalBName = libFun FSLIT("normalB") normalBIdKey
+guardedBName, normalBName :: Name
+guardedBName = libFun (fsLit "guardedB") guardedBIdKey
+normalBName = libFun (fsLit "normalB") normalBIdKey
-- data Guard = ...
-normalGEName = libFun FSLIT("normalGE") normalGEIdKey
-patGEName = libFun FSLIT("patGE") patGEIdKey
+normalGEName, patGEName :: Name
+normalGEName = libFun (fsLit "normalGE") normalGEIdKey
+patGEName = libFun (fsLit "patGE") patGEIdKey
-- data Stmt = ...
-bindSName = libFun FSLIT("bindS") bindSIdKey
-letSName = libFun FSLIT("letS") letSIdKey
-noBindSName = libFun FSLIT("noBindS") noBindSIdKey
-parSName = libFun FSLIT("parS") parSIdKey
+bindSName, letSName, noBindSName, parSName :: Name
+bindSName = libFun (fsLit "bindS") bindSIdKey
+letSName = libFun (fsLit "letS") letSIdKey
+noBindSName = libFun (fsLit "noBindS") noBindSIdKey
+parSName = libFun (fsLit "parS") parSIdKey
-- data Dec = ...
-funDName = libFun FSLIT("funD") funDIdKey
-valDName = libFun FSLIT("valD") valDIdKey
-dataDName = libFun FSLIT("dataD") dataDIdKey
-newtypeDName = libFun FSLIT("newtypeD") newtypeDIdKey
-tySynDName = libFun FSLIT("tySynD") tySynDIdKey
-classDName = libFun FSLIT("classD") classDIdKey
-instanceDName = libFun FSLIT("instanceD") instanceDIdKey
-sigDName = libFun FSLIT("sigD") sigDIdKey
-forImpDName = libFun FSLIT("forImpD") forImpDIdKey
+funDName, valDName, dataDName, newtypeDName, tySynDName, classDName,
+ instanceDName, sigDName, forImpDName :: Name
+funDName = libFun (fsLit "funD") funDIdKey
+valDName = libFun (fsLit "valD") valDIdKey
+dataDName = libFun (fsLit "dataD") dataDIdKey
+newtypeDName = libFun (fsLit "newtypeD") newtypeDIdKey
+tySynDName = libFun (fsLit "tySynD") tySynDIdKey
+classDName = libFun (fsLit "classD") classDIdKey
+instanceDName = libFun (fsLit "instanceD") instanceDIdKey
+sigDName = libFun (fsLit "sigD") sigDIdKey
+forImpDName = libFun (fsLit "forImpD") forImpDIdKey
-- type Ctxt = ...
-cxtName = libFun FSLIT("cxt") cxtIdKey
+cxtName :: Name
+cxtName = libFun (fsLit "cxt") cxtIdKey
-- data Strict = ...
-isStrictName = libFun FSLIT("isStrict") isStrictKey
-notStrictName = libFun FSLIT("notStrict") notStrictKey
-
--- data Con = ...
-normalCName = libFun FSLIT("normalC") normalCIdKey
-recCName = libFun FSLIT("recC") recCIdKey
-infixCName = libFun FSLIT("infixC") infixCIdKey
-forallCName = libFun FSLIT("forallC") forallCIdKey
-
+isStrictName, notStrictName :: Name
+isStrictName = libFun (fsLit "isStrict") isStrictKey
+notStrictName = libFun (fsLit "notStrict") notStrictKey
+
+-- data Con = ...
+normalCName, recCName, infixCName, forallCName :: Name
+normalCName = libFun (fsLit "normalC") normalCIdKey
+recCName = libFun (fsLit "recC") recCIdKey
+infixCName = libFun (fsLit "infixC") infixCIdKey
+forallCName = libFun (fsLit "forallC") forallCIdKey
+
-- type StrictType = ...
-strictTypeName = libFun FSLIT("strictType") strictTKey
+strictTypeName :: Name
+strictTypeName = libFun (fsLit "strictType") strictTKey
-- type VarStrictType = ...
-varStrictTypeName = libFun FSLIT("varStrictType") varStrictTKey
+varStrictTypeName :: Name
+varStrictTypeName = libFun (fsLit "varStrictType") varStrictTKey
-- data Type = ...
-forallTName = libFun FSLIT("forallT") forallTIdKey
-varTName = libFun FSLIT("varT") varTIdKey
-conTName = libFun FSLIT("conT") conTIdKey
-tupleTName = libFun FSLIT("tupleT") tupleTIdKey
-arrowTName = libFun FSLIT("arrowT") arrowTIdKey
-listTName = libFun FSLIT("listT") listTIdKey
-appTName = libFun FSLIT("appT") appTIdKey
-
+forallTName, varTName, conTName, tupleTName, arrowTName,
+ listTName, appTName :: Name
+forallTName = libFun (fsLit "forallT") forallTIdKey
+varTName = libFun (fsLit "varT") varTIdKey
+conTName = libFun (fsLit "conT") conTIdKey
+tupleTName = libFun (fsLit "tupleT") tupleTIdKey
+arrowTName = libFun (fsLit "arrowT") arrowTIdKey
+listTName = libFun (fsLit "listT") listTIdKey
+appTName = libFun (fsLit "appT") appTIdKey
+
-- data Callconv = ...
-cCallName = libFun FSLIT("cCall") cCallIdKey
-stdCallName = libFun FSLIT("stdCall") stdCallIdKey
+cCallName, stdCallName :: Name
+cCallName = libFun (fsLit "cCall") cCallIdKey
+stdCallName = libFun (fsLit "stdCall") stdCallIdKey
-- data Safety = ...
-unsafeName = libFun FSLIT("unsafe") unsafeIdKey
-safeName = libFun FSLIT("safe") safeIdKey
-threadsafeName = libFun FSLIT("threadsafe") threadsafeIdKey
-
+unsafeName, safeName, threadsafeName :: Name
+unsafeName = libFun (fsLit "unsafe") unsafeIdKey
+safeName = libFun (fsLit "safe") safeIdKey
+threadsafeName = libFun (fsLit "threadsafe") threadsafeIdKey
+
-- data FunDep = ...
-funDepName = libFun FSLIT("funDep") funDepIdKey
-
-matchQTyConName = libTc FSLIT("MatchQ") matchQTyConKey
-clauseQTyConName = libTc FSLIT("ClauseQ") clauseQTyConKey
-expQTyConName = libTc FSLIT("ExpQ") expQTyConKey
-stmtQTyConName = libTc FSLIT("StmtQ") stmtQTyConKey
-decQTyConName = libTc FSLIT("DecQ") decQTyConKey
-conQTyConName = libTc FSLIT("ConQ") conQTyConKey
-strictTypeQTyConName = libTc FSLIT("StrictTypeQ") strictTypeQTyConKey
-varStrictTypeQTyConName = libTc FSLIT("VarStrictTypeQ") varStrictTypeQTyConKey
-typeQTyConName = libTc FSLIT("TypeQ") typeQTyConKey
-fieldExpQTyConName = libTc FSLIT("FieldExpQ") fieldExpQTyConKey
-patQTyConName = libTc FSLIT("PatQ") patQTyConKey
-fieldPatQTyConName = libTc FSLIT("FieldPatQ") fieldPatQTyConKey
-
--- TyConUniques available: 100-129
--- Check in PrelNames if you want to change this
+funDepName :: Name
+funDepName = libFun (fsLit "funDep") funDepIdKey
+matchQTyConName, clauseQTyConName, expQTyConName, stmtQTyConName,
+ decQTyConName, conQTyConName, strictTypeQTyConName,
+ varStrictTypeQTyConName, typeQTyConName, fieldExpQTyConName,
+ patQTyConName, fieldPatQTyConName :: Name
+matchQTyConName = libTc (fsLit "MatchQ") matchQTyConKey
+clauseQTyConName = libTc (fsLit "ClauseQ") clauseQTyConKey
+expQTyConName = libTc (fsLit "ExpQ") expQTyConKey
+stmtQTyConName = libTc (fsLit "StmtQ") stmtQTyConKey
+decQTyConName = libTc (fsLit "DecQ") decQTyConKey
+conQTyConName = libTc (fsLit "ConQ") conQTyConKey
+strictTypeQTyConName = libTc (fsLit "StrictTypeQ") strictTypeQTyConKey
+varStrictTypeQTyConName = libTc (fsLit "VarStrictTypeQ") varStrictTypeQTyConKey
+typeQTyConName = libTc (fsLit "TypeQ") typeQTyConKey
+fieldExpQTyConName = libTc (fsLit "FieldExpQ") fieldExpQTyConKey
+patQTyConName = libTc (fsLit "PatQ") patQTyConKey
+fieldPatQTyConName = libTc (fsLit "FieldPatQ") fieldPatQTyConKey
+
+-- quasiquoting
+quoteExpName, quotePatName :: Name
+quoteExpName = qqFun (fsLit "quoteExp") quoteExpKey
+quotePatName = qqFun (fsLit "quotePat") quotePatKey
+
+-- TyConUniques available: 100-129
+-- Check in PrelNames if you want to change this
+
+expTyConKey, matchTyConKey, clauseTyConKey, qTyConKey, expQTyConKey,
+ decQTyConKey, patTyConKey, matchQTyConKey, clauseQTyConKey,
+ stmtQTyConKey, conQTyConKey, typeQTyConKey, typeTyConKey,
+ decTyConKey, varStrictTypeQTyConKey, strictTypeQTyConKey,
+ fieldExpTyConKey, fieldPatTyConKey, nameTyConKey, patQTyConKey,
+ fieldPatQTyConKey, fieldExpQTyConKey, funDepTyConKey :: Unique
expTyConKey = mkPreludeTyConUnique 100
matchTyConKey = mkPreludeTyConUnique 101
clauseTyConKey = mkPreludeTyConUnique 102
fieldExpQTyConKey = mkPreludeTyConUnique 121
funDepTyConKey = mkPreludeTyConUnique 122
--- IdUniques available: 200-399
--- If you want to change this, make sure you check in PrelNames
+-- IdUniques available: 200-399
+-- If you want to change this, make sure you check in PrelNames
+returnQIdKey, bindQIdKey, sequenceQIdKey, liftIdKey, newNameIdKey,
+ mkNameIdKey, mkNameG_vIdKey, mkNameG_dIdKey, mkNameG_tcIdKey,
+ mkNameLIdKey :: Unique
returnQIdKey = mkPreludeMiscIdUnique 200
bindQIdKey = mkPreludeMiscIdUnique 201
sequenceQIdKey = mkPreludeMiscIdUnique 202
-- data Lit = ...
+charLIdKey, stringLIdKey, integerLIdKey, intPrimLIdKey, wordPrimLIdKey,
+ floatPrimLIdKey, doublePrimLIdKey, rationalLIdKey :: Unique
charLIdKey = mkPreludeMiscIdUnique 210
stringLIdKey = mkPreludeMiscIdUnique 211
integerLIdKey = mkPreludeMiscIdUnique 212
intPrimLIdKey = mkPreludeMiscIdUnique 213
-floatPrimLIdKey = mkPreludeMiscIdUnique 214
-doublePrimLIdKey = mkPreludeMiscIdUnique 215
-rationalLIdKey = mkPreludeMiscIdUnique 216
+wordPrimLIdKey = mkPreludeMiscIdUnique 214
+floatPrimLIdKey = mkPreludeMiscIdUnique 215
+doublePrimLIdKey = mkPreludeMiscIdUnique 216
+rationalLIdKey = mkPreludeMiscIdUnique 217
-- data Pat = ...
+litPIdKey, varPIdKey, tupPIdKey, conPIdKey, infixPIdKey, tildePIdKey,
+ asPIdKey, wildPIdKey, recPIdKey, listPIdKey, sigPIdKey :: Unique
litPIdKey = mkPreludeMiscIdUnique 220
varPIdKey = mkPreludeMiscIdUnique 221
tupPIdKey = mkPreludeMiscIdUnique 222
sigPIdKey = mkPreludeMiscIdUnique 229
-- type FieldPat = ...
+fieldPatIdKey :: Unique
fieldPatIdKey = mkPreludeMiscIdUnique 230
-- data Match = ...
+matchIdKey :: Unique
matchIdKey = mkPreludeMiscIdUnique 231
-- data Clause = ...
+clauseIdKey :: Unique
clauseIdKey = mkPreludeMiscIdUnique 232
-- data Exp = ...
+varEIdKey, conEIdKey, litEIdKey, appEIdKey, infixEIdKey, infixAppIdKey,
+ sectionLIdKey, sectionRIdKey, lamEIdKey, tupEIdKey, condEIdKey,
+ letEIdKey, caseEIdKey, doEIdKey, compEIdKey,
+ fromEIdKey, fromThenEIdKey, fromToEIdKey, fromThenToEIdKey,
+ listEIdKey, sigEIdKey, recConEIdKey, recUpdEIdKey :: Unique
varEIdKey = mkPreludeMiscIdUnique 240
conEIdKey = mkPreludeMiscIdUnique 241
litEIdKey = mkPreludeMiscIdUnique 242
recUpdEIdKey = mkPreludeMiscIdUnique 262
-- type FieldExp = ...
+fieldExpIdKey :: Unique
fieldExpIdKey = mkPreludeMiscIdUnique 265
-- data Body = ...
+guardedBIdKey, normalBIdKey :: Unique
guardedBIdKey = mkPreludeMiscIdUnique 266
normalBIdKey = mkPreludeMiscIdUnique 267
-- data Guard = ...
+normalGEIdKey, patGEIdKey :: Unique
normalGEIdKey = mkPreludeMiscIdUnique 310
patGEIdKey = mkPreludeMiscIdUnique 311
-- data Stmt = ...
+bindSIdKey, letSIdKey, noBindSIdKey, parSIdKey :: Unique
bindSIdKey = mkPreludeMiscIdUnique 268
letSIdKey = mkPreludeMiscIdUnique 269
noBindSIdKey = mkPreludeMiscIdUnique 270
parSIdKey = mkPreludeMiscIdUnique 271
-- data Dec = ...
+funDIdKey, valDIdKey, dataDIdKey, newtypeDIdKey, tySynDIdKey,
+ classDIdKey, instanceDIdKey, sigDIdKey, forImpDIdKey :: Unique
funDIdKey = mkPreludeMiscIdUnique 272
valDIdKey = mkPreludeMiscIdUnique 273
dataDIdKey = mkPreludeMiscIdUnique 274
forImpDIdKey = mkPreludeMiscIdUnique 297
-- type Cxt = ...
+cxtIdKey :: Unique
cxtIdKey = mkPreludeMiscIdUnique 280
-- data Strict = ...
+isStrictKey, notStrictKey :: Unique
isStrictKey = mkPreludeMiscIdUnique 281
notStrictKey = mkPreludeMiscIdUnique 282
-- data Con = ...
+normalCIdKey, recCIdKey, infixCIdKey, forallCIdKey :: Unique
normalCIdKey = mkPreludeMiscIdUnique 283
recCIdKey = mkPreludeMiscIdUnique 284
infixCIdKey = mkPreludeMiscIdUnique 285
forallCIdKey = mkPreludeMiscIdUnique 288
-- type StrictType = ...
+strictTKey :: Unique
strictTKey = mkPreludeMiscIdUnique 286
-- type VarStrictType = ...
+varStrictTKey :: Unique
varStrictTKey = mkPreludeMiscIdUnique 287
-- data Type = ...
+forallTIdKey, varTIdKey, conTIdKey, tupleTIdKey, arrowTIdKey,
+ listTIdKey, appTIdKey :: Unique
forallTIdKey = mkPreludeMiscIdUnique 290
varTIdKey = mkPreludeMiscIdUnique 291
conTIdKey = mkPreludeMiscIdUnique 292
appTIdKey = mkPreludeMiscIdUnique 293
-- data Callconv = ...
+cCallIdKey, stdCallIdKey :: Unique
cCallIdKey = mkPreludeMiscIdUnique 300
stdCallIdKey = mkPreludeMiscIdUnique 301
-- data Safety = ...
+unsafeIdKey, safeIdKey, threadsafeIdKey :: Unique
unsafeIdKey = mkPreludeMiscIdUnique 305
safeIdKey = mkPreludeMiscIdUnique 306
threadsafeIdKey = mkPreludeMiscIdUnique 307
-- data FunDep = ...
+funDepIdKey :: Unique
funDepIdKey = mkPreludeMiscIdUnique 320
+-- quasiquoting
+quoteExpKey, quotePatKey :: Unique
+quoteExpKey = mkPreludeMiscIdUnique 321
+quotePatKey = mkPreludeMiscIdUnique 322
+