Commit 047b3b8c authored by gmainland's avatar gmainland

Clean up smart constructors for splices.

parent 1e6a9410
......@@ -54,7 +54,7 @@ module HsUtils(
emptyRecStmt, mkRecStmt,
-- Template Haskell
unqualSplice, mkHsSpliceTy, mkHsSplice, mkHsTExpSplice, mkHsQuasiQuote, unqualQuasiQuote,
unqualSplice, mkHsSpliceTy, mkHsSpliceE, mkHsSpliceTE, mkHsQuasiQuote, unqualQuasiQuote,
-- Flags
noRebindableInfo,
......@@ -246,14 +246,17 @@ mkRecStmt stmts = emptyRecStmt { recS_stmts = stmts }
mkHsOpApp :: LHsExpr id -> id -> LHsExpr id -> HsExpr id
mkHsOpApp e1 op e2 = OpApp e1 (noLoc (HsVar op)) (error "mkOpApp:fixity") e2
mkHsSplice :: LHsExpr RdrName -> HsSplice RdrName
mkHsSplice e = HsSplice False unqualSplice e
mkHsSplice :: Bool -> LHsExpr RdrName -> HsSplice RdrName
mkHsSplice isTyped e = HsSplice isTyped unqualSplice e
mkHsTExpSplice :: LHsExpr RdrName -> HsSplice RdrName
mkHsTExpSplice e = HsSplice True unqualSplice e
mkHsSpliceE :: LHsExpr RdrName -> HsExpr RdrName
mkHsSpliceE e = HsSpliceE (mkHsSplice False e)
mkHsSpliceTE :: LHsExpr RdrName -> HsExpr RdrName
mkHsSpliceTE e = HsSpliceE (mkHsSplice True e)
mkHsSpliceTy :: LHsExpr RdrName -> HsType RdrName
mkHsSpliceTy e = HsSpliceTy (mkHsSplice e) emptyFVs placeHolderKind
mkHsSpliceTy e = HsSpliceTy (mkHsSplice False e) emptyFVs placeHolderKind
unqualSplice :: RdrName
unqualSplice = mkRdrUnqual (mkVarOccFS (fsLit "splice"))
......
......@@ -1552,14 +1552,14 @@ aexp2 :: { LHsExpr RdrName }
| '_' { L1 EWildPat }
-- Template Haskell Extension
| TH_ID_SPLICE { L1 $ HsSpliceE (mkHsSplice
| TH_ID_SPLICE { L1 $ mkHsSpliceE
(L1 $ HsVar (mkUnqual varName
(getTH_ID_SPLICE $1)))) }
| '$(' exp ')' { LL $ HsSpliceE (mkHsSplice $2) }
| TH_ID_TY_SPLICE { L1 $ HsSpliceE (mkHsTExpSplice
(getTH_ID_SPLICE $1))) }
| '$(' exp ')' { LL $ mkHsSpliceE $2 }
| TH_ID_TY_SPLICE { L1 $ mkHsSpliceTE
(L1 $ HsVar (mkUnqual varName
(getTH_ID_TY_SPLICE $1)))) }
| '$$(' exp ')' { LL $ HsSpliceE (mkHsTExpSplice $2) }
(getTH_ID_TY_SPLICE $1))) }
| '$$(' exp ')' { LL $ mkHsSpliceTE $2 }
| SIMPLEQUOTE qvar { LL $ HsBracket (VarBr True (unLoc $2)) }
......
......@@ -7,7 +7,7 @@ Functions over HsSyn specialised to RdrName.
module RdrHsSyn (
mkHsOpApp,
mkHsIntegral, mkHsFractional, mkHsIsString,
mkHsDo, mkHsSplice, mkTopSpliceDecl,
mkHsDo, mkTopSpliceDecl,
mkRoleAnnotDecl,
mkClassDecl,
mkTyData, mkFamInstData,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment