summaryrefslogtreecommitdiff
path: root/compiler/Language/Haskell/Syntax
diff options
context:
space:
mode:
authorromes <rodrigo.m.mesquita@gmail.com>2022-03-10 20:02:36 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-03-18 05:10:58 -0400
commit310890a51372937afa69e1edac1179eba67ac046 (patch)
treea69e155c1f7bf29d3a2a4c5d2f0c394e1dfdf06f /compiler/Language/Haskell/Syntax
parent19163397000ae3ce9886a75bef900d35774d864e (diff)
downloadhaskell-310890a51372937afa69e1edac1179eba67ac046.tar.gz
Separate constructors for typed and untyped brackets
Split HsBracket into HsTypedBracket and HsUntypedBracket. Unfortunately, we still cannot get rid of instance XXTypedBracket GhcTc = HsTypedBracket GhcRn despite no longer requiring it for typechecking, but rather because the TH desugarer works on GhcRn rather than GhcTc (See GHC.HsToCore.Quote)
Diffstat (limited to 'compiler/Language/Haskell/Syntax')
-rw-r--r--compiler/Language/Haskell/Syntax/Expr.hs23
-rw-r--r--compiler/Language/Haskell/Syntax/Extension.hs23
2 files changed, 25 insertions, 21 deletions
diff --git a/compiler/Language/Haskell/Syntax/Expr.hs b/compiler/Language/Haskell/Syntax/Expr.hs
index dd3e8b4545..0d4b3251a0 100644
--- a/compiler/Language/Haskell/Syntax/Expr.hs
+++ b/compiler/Language/Haskell/Syntax/Expr.hs
@@ -593,7 +593,8 @@ data HsExpr p
-- 'GHC.Parser.Annotation.AnnClose','GHC.Parser.Annotation.AnnCloseQ'
-- For details on above see Note [exact print annotations] in GHC.Parser.Annotation
- | HsBracket (XBracket p) (HsBracket p)
+ | HsTypedBracket (XTypedBracket p) (HsTypedBracket p)
+ | HsUntypedBracket (XUntypedBracket p) (HsUntypedBracket p)
-- | - 'GHC.Parser.Annotation.AnnKeywordId' : 'GHC.Parser.Annotation.AnnOpen',
-- 'GHC.Parser.Annotation.AnnClose'
@@ -1604,22 +1605,22 @@ data UntypedSpliceFlavour
| UntypedDeclSplice
deriving Data
--- | Haskell Bracket
-data HsBracket p
- = ExpBr (XExpBr p) (LHsExpr p) -- [| expr |]
+-- | Haskell Typed Bracket
+data HsTypedBracket p
+ = TExpBr (XTExpBr p) (LHsExpr p) -- [|| texp ||]
+ | XTypedBracket !(XXTypedBracket p) -- Extension point; see Note [Trees That Grow]
+ -- in Language.Haskell.Syntax.Extension
+-- | Haskell Untyped Bracket
+data HsUntypedBracket p
+ = ExpBr (XExpBr p) (LHsExpr p) -- [| expr |]
| PatBr (XPatBr p) (LPat p) -- [p| pat |]
| DecBrL (XDecBrL p) [LHsDecl p] -- [d| decls |]; result of parser
| DecBrG (XDecBrG p) (HsGroup p) -- [d| decls |]; result of renamer
| TypBr (XTypBr p) (LHsType p) -- [t| type |]
| VarBr (XVarBr p) Bool (LIdP p)
-- True: 'x, False: ''T
- | TExpBr (XTExpBr p) (LHsExpr p) -- [|| expr ||]
- | XBracket !(XXBracket p) -- Extension point; see Note [Trees That Grow]
- -- in Language.Haskell.Syntax.Extension
-
-isTypedBracket :: HsBracket id -> Bool
-isTypedBracket (TExpBr {}) = True
-isTypedBracket _ = False
+ | XUntypedBracket !(XXUntypedBracket p) -- Extension point; see Note [Trees That Grow]
+ -- in Language.Haskell.Syntax.Extension
{-
************************************************************************
diff --git a/compiler/Language/Haskell/Syntax/Extension.hs b/compiler/Language/Haskell/Syntax/Extension.hs
index 93c66fce35..df443eb451 100644
--- a/compiler/Language/Haskell/Syntax/Extension.hs
+++ b/compiler/Language/Haskell/Syntax/Extension.hs
@@ -429,7 +429,8 @@ type family XGetField x
type family XProjection x
type family XExprWithTySig x
type family XArithSeq x
-type family XBracket x
+type family XTypedBracket x
+type family XUntypedBracket x
type family XSpliceE x
type family XProc x
type family XStatic x
@@ -470,15 +471,17 @@ type family XSpliced x
type family XXSplice x
-- -------------------------------------
--- HsBracket type families
-type family XExpBr x
-type family XPatBr x
-type family XDecBrL x
-type family XDecBrG x
-type family XTypBr x
-type family XVarBr x
-type family XTExpBr x
-type family XXBracket x
+-- HsTypedBracket type families
+type family XTExpBr x
+type family XXTypedBracket x
+-- HsUntypedBracket type families
+type family XExpBr x
+type family XPatBr x
+type family XDecBrL x
+type family XDecBrG x
+type family XTypBr x
+type family XVarBr x
+type family XXUntypedBracket x
-- -------------------------------------
-- HsCmdTop type families