diff options
author | Mikhail Vorozhtsov <mikhail.vorozhtsov@gmail.com> | 2016-11-05 22:06:39 +0000 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2016-11-05 22:07:30 +0000 |
commit | b0121209f8fb47a7cb8fc32e10d8e2c06d4502c2 (patch) | |
tree | 5bfb1e8eaa580b3b5ad6bbc08176e8f2fd90c1bd /compiler/deSugar/DsMeta.hs | |
parent | 2cdd9bd5208e3ad78d7a3b8b82c8ae1be486b34d (diff) | |
download | haskell-b0121209f8fb47a7cb8fc32e10d8e2c06d4502c2.tar.gz |
Handle types w/ type variables in signatures inside patterns (DsMeta)
The comment indicated that scoping of type variables was a large problem
but Simon fixed it in e21e13fb52b99b14770cc5857df57bbcc9c85102.
Thus, we can implement repP for signatures very easily in the usual way
now.
Reviewers: goldfire, simonpj, austin, bgamari
Reviewed By: simonpj
Subscribers: mpickering, simonpj, thomie
Differential Revision: https://phabricator.haskell.org/D2490
GHC Trac Issues: #12164
Diffstat (limited to 'compiler/deSugar/DsMeta.hs')
-rw-r--r-- | compiler/deSugar/DsMeta.hs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/compiler/deSugar/DsMeta.hs b/compiler/deSugar/DsMeta.hs index d8fdb54183..6b40a04446 100644 --- a/compiler/deSugar/DsMeta.hs +++ b/compiler/deSugar/DsMeta.hs @@ -1616,14 +1616,9 @@ repP (ConPatIn dc details) repP (NPat (L _ l) Nothing _ _) = do { a <- repOverloadedLiteral l; repPlit a } repP (ViewPat e p _) = do { e' <- repLE e; p' <- repLP p; repPview e' p' } 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 - -- here in DsMeta, and I don't want to do that today! - -- do { p' <- repLP p; t' <- repLTy t; repPsig p' t' } - -- repPsig :: Core TH.PatQ -> Core TH.TypeQ -> DsM (Core TH.PatQ) - -- repPsig (MkC p) (MkC t) = rep2 sigPName [p, t] - +repP (SigPatIn p t) = do { p' <- repLP p + ; t' <- repLTy (hsSigWcType t) + ; repPsig p' t' } repP (SplicePat splice) = repSplice splice repP other = notHandled "Exotic pattern" (ppr other) @@ -1841,6 +1836,9 @@ repPlist (MkC ps) = rep2 listPName [ps] repPview :: Core TH.ExpQ -> Core TH.PatQ -> DsM (Core TH.PatQ) repPview (MkC e) (MkC p) = rep2 viewPName [e,p] +repPsig :: Core TH.PatQ -> Core TH.TypeQ -> DsM (Core TH.PatQ) +repPsig (MkC p) (MkC t) = rep2 sigPName [p, t] + --------------- Expressions ----------------- repVarOrCon :: Name -> Core TH.Name -> DsM (Core TH.ExpQ) repVarOrCon vc str | isDataOcc (nameOccName vc) = repCon str |