[commit: ghc] wip/gadtpm: Comments (4bdec1b)
git at git.haskell.org
git at git.haskell.org
Tue Jun 23 09:16:16 UTC 2015
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/gadtpm
Link : http://ghc.haskell.org/trac/ghc/changeset/4bdec1b1576508fa522f461c564f815d205d4857/ghc
>---------------------------------------------------------------
commit 4bdec1b1576508fa522f461c564f815d205d4857
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Mon Jun 22 15:58:05 2015 +0100
Comments
>---------------------------------------------------------------
4bdec1b1576508fa522f461c564f815d205d4857
compiler/deSugar/Check.hs | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/compiler/deSugar/Check.hs b/compiler/deSugar/Check.hs
index c20375d..72e5bf3 100644
--- a/compiler/deSugar/Check.hs
+++ b/compiler/deSugar/Check.hs
@@ -215,7 +215,12 @@ translatePat usupply pat = case pat of
g = GBindAbs pats $ PmExprOther $ HsApp (noLoc to_list) xe -- [...] <- toList x
in [xp,g]
- ConPatOut { pat_con = L _ (PatSynCon _) } -> -- CHECKME: Is there a way to unfold this into a normal pattern?
+ ConPatOut { pat_con = L _ (PatSynCon _) } ->
+ -- Pattern synonyms have a "matcher" (see Note [Pattern synonym representation] in PatSyn.hs
+ -- We should be able to transform (P x y)
+ -- to v (Just (x, y) <- matchP v (\x y -> Just (x,y)) Nothing
+ -- That is, a combination of a variable pattern and a guard
+ -- But there are complications with GADTs etc, and this isn't done yet
[mkPmVar usupply (hsPatType pat)]
ConPatOut { pat_con = L _ (RealDataCon con), pat_args = ps } ->
More information about the ghc-commits
mailing list