summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDr. ERDI Gergo <gergo@erdi.hu>2014-07-27 21:00:15 +0200
committerDr. ERDI Gergo <gergo@erdi.hu>2014-07-29 11:34:41 +0200
commit25c2eebc4ad0c1dc4f4c371f39bd5336546ec094 (patch)
treeb6cd2975486794db0fc46c02390930b71686f517
parentd84a5cc930ee99c3b4d89594162234304a57e2f5 (diff)
downloadhaskell-25c2eebc4ad0c1dc4f4c371f39bd5336546ec094.tar.gz
tcLookupPatSyn: look up the PatSyn record for a given Id
-rw-r--r--compiler/typecheck/TcEnv.lhs14
1 files changed, 11 insertions, 3 deletions
diff --git a/compiler/typecheck/TcEnv.lhs b/compiler/typecheck/TcEnv.lhs
index d9a412278a..f4c7c10063 100644
--- a/compiler/typecheck/TcEnv.lhs
+++ b/compiler/typecheck/TcEnv.lhs
@@ -18,8 +18,8 @@ module TcEnv(
tcExtendGlobalEnv, tcExtendGlobalEnvImplicit, setGlobalTypeEnv,
tcExtendGlobalValEnv,
tcLookupLocatedGlobal, tcLookupGlobal,
- tcLookupField, tcLookupTyCon, tcLookupClass, tcLookupDataCon,
- tcLookupConLike,
+ tcLookupField, tcLookupTyCon, tcLookupClass,
+ tcLookupDataCon, tcLookupPatSyn, tcLookupConLike,
tcLookupLocatedGlobalId, tcLookupLocatedTyCon,
tcLookupLocatedClass, tcLookupInstance, tcLookupAxiom,
@@ -73,7 +73,8 @@ import Var
import VarSet
import RdrName
import InstEnv
-import DataCon
+import DataCon ( DataCon )
+import PatSyn ( PatSyn )
import ConLike
import TyCon
import CoAxiom
@@ -160,6 +161,13 @@ tcLookupDataCon name = do
AConLike (RealDataCon con) -> return con
_ -> wrongThingErr "data constructor" (AGlobal thing) name
+tcLookupPatSyn :: Name -> TcM PatSyn
+tcLookupPatSyn name = do
+ thing <- tcLookupGlobal name
+ case thing of
+ AConLike (PatSynCon ps) -> return ps
+ _ -> wrongThingErr "pattern synonym" (AGlobal thing) name
+
tcLookupConLike :: Name -> TcM ConLike
tcLookupConLike name = do
thing <- tcLookupGlobal name