summaryrefslogtreecommitdiff
path: root/compiler/Language
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/Language')
-rw-r--r--compiler/Language/Haskell/Syntax/Expr.hs4
-rw-r--r--compiler/Language/Haskell/Syntax/Extension.hs4
-rw-r--r--compiler/Language/Haskell/Syntax/Pat.hs14
3 files changed, 18 insertions, 4 deletions
diff --git a/compiler/Language/Haskell/Syntax/Expr.hs b/compiler/Language/Haskell/Syntax/Expr.hs
index 326c9903dc..5f774de2e4 100644
--- a/compiler/Language/Haskell/Syntax/Expr.hs
+++ b/compiler/Language/Haskell/Syntax/Expr.hs
@@ -976,8 +976,8 @@ data Match p body
= Match {
m_ext :: XCMatch p body,
m_ctxt :: HsMatchContext p,
- -- See Note [m_ctxt in Match]
- m_pats :: [LPat p], -- The patterns
+ -- See note [m_ctxt in Match]
+ m_pats :: [LMatchPat p], -- The patterns
m_grhss :: (GRHSs p body)
}
| XMatch !(XXMatch p body)
diff --git a/compiler/Language/Haskell/Syntax/Extension.hs b/compiler/Language/Haskell/Syntax/Extension.hs
index 4bdb3ce3cb..bea00f86f8 100644
--- a/compiler/Language/Haskell/Syntax/Extension.hs
+++ b/compiler/Language/Haskell/Syntax/Extension.hs
@@ -604,6 +604,10 @@ type family XSigPat x
type family XCoPat x
type family XXPat x
type family XHsFieldBind x
+type family XVisPat x
+type family XInvisTyVarPat x
+type family XInvisWildTyPat x
+type family XXMatchPat x
-- =====================================================================
-- Type families for the HsTypes type families
diff --git a/compiler/Language/Haskell/Syntax/Pat.hs b/compiler/Language/Haskell/Syntax/Pat.hs
index 95abde9ce0..5f5f73362c 100644
--- a/compiler/Language/Haskell/Syntax/Pat.hs
+++ b/compiler/Language/Haskell/Syntax/Pat.hs
@@ -19,8 +19,7 @@
-- See Note [Language.Haskell.Syntax.* Hierarchy] for why not GHC.Hs.*
module Language.Haskell.Syntax.Pat (
- Pat(..), LPat,
- ConLikeP,
+ Pat(..), LPat, MatchPat(..), LMatchPat, ConLikeP,
HsConPatDetails, hsConPatArgs,
HsConPatTyArg(..),
@@ -224,6 +223,17 @@ data Pat p
type family ConLikeP x
+-- | A pattern to be used in a sequence of patterns, like what appears
+-- to the right of @f@ in @f a b True = ...@. A 'MatchPat' allows for the
+-- possibility of binding a /type variable/ with \@.
+data MatchPat pass
+ = VisPat (XVisPat pass) (LPat pass)
+ -- () means that we don't accept f @{x} syntax
+ | InvisTyVarPat (XInvisTyVarPat pass) (LHsTyVarBndr () pass)
+ | InvisWildTyPat (XInvisWildTyPat pass)
+ | XMatchPat !(XXMatchPat pass)
+
+type LMatchPat pass = XRec pass (MatchPat pass)
-- ---------------------------------------------------------------------