X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Ftypecheck%2FTcEnv.lhs;h=388828ee4b051946af8920347eeb43d61289e5ae;hb=f7f06be1f47dcb3a48c4bc7ef0a2c59e49e28115;hp=497ba235da4b754d889c5220ffa202b360a7b112;hpb=0065d5ab628975892cea1ec7303f968c3338cbe1;p=ghc-hetmet.git diff --git a/compiler/typecheck/TcEnv.lhs b/compiler/typecheck/TcEnv.lhs index 497ba23..388828e 100644 --- a/compiler/typecheck/TcEnv.lhs +++ b/compiler/typecheck/TcEnv.lhs @@ -11,7 +11,7 @@ module TcEnv( tcExtendGlobalEnv, tcExtendGlobalValEnv, tcLookupLocatedGlobal, tcLookupGlobal, - tcLookupGlobalId, tcLookupTyCon, tcLookupClass, tcLookupDataCon, + tcLookupField, tcLookupTyCon, tcLookupClass, tcLookupDataCon, tcLookupLocatedGlobalId, tcLookupLocatedTyCon, tcLookupLocatedClass, @@ -121,16 +121,19 @@ tcLookupGlobal name tcImportDecl name -- Go find it in an interface }}}}} -tcLookupGlobalId :: Name -> TcM Id --- Never used for Haskell-source DataCons, hence no ADataCon case -tcLookupGlobalId name +tcLookupField :: Name -> TcM Id -- Returns the selector Id +tcLookupField name = tcLookupGlobal name `thenM` \ thing -> - return (tyThingId thing) + case thing of + AnId id -> return id + other -> wrongThingErr "field name" (AGlobal thing) name tcLookupDataCon :: Name -> TcM DataCon -tcLookupDataCon con_name - = tcLookupGlobal con_name `thenM` \ thing -> - return (tyThingDataCon thing) +tcLookupDataCon name + = tcLookupGlobal name `thenM` \ thing -> + case thing of + ADataCon con -> return con + other -> wrongThingErr "data constructor" (AGlobal thing) name tcLookupClass :: Name -> TcM Class tcLookupClass name