X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Ftypecheck%2FTcEnv.lhs;h=14f9541f2950f4d0029bcd408b46ed97f8b76452;hp=9afe28fdba1ee69ab34121a1a928c17778d524c2;hb=9ffadf219cbc4f8ec57264786df936a3cee88aec;hpb=9bcd95bad83ee937c178970e8b729732e680fe1e diff --git a/compiler/typecheck/TcEnv.lhs b/compiler/typecheck/TcEnv.lhs index 9afe28f..14f9541 100644 --- a/compiler/typecheck/TcEnv.lhs +++ b/compiler/typecheck/TcEnv.lhs @@ -57,6 +57,7 @@ import TcType -- import TcSuspension import qualified Type import Id +import Coercion import Var import VarSet import VarEnv @@ -125,11 +126,8 @@ tcLookupGlobal name }}}}} tcLookupField :: Name -> TcM Id -- Returns the selector Id -tcLookupField name = do - thing <- tcLookup name -- Note [Record field lookup] - case thing of - AGlobal (AnId id) -> return id - thing -> wrongThingErr "field name" thing name +tcLookupField name + = tcLookupId name -- Note [Record field lookup] {- Note [Record field lookup] ~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -642,8 +640,12 @@ data InstBindings a -- specialised instances | NewTypeDerived -- Used for deriving instances of newtypes, where the - -- witness dictionary is identical to the argument + CoercionI -- witness dictionary is identical to the argument -- dictionary. Hence no bindings, no pragmas. + -- The coercion maps from newtype to the representation type + -- (mentioning type variables bound by the forall'd iSpec variables) + -- E.g. newtype instance N [a] = N1 (Tree a) + -- co : N [a] ~ Tree a pprInstInfo :: InstInfo a -> SDoc pprInstInfo info = vcat [ptext (sLit "InstInfo:") <+> ppr (idType (iDFunId info))] @@ -651,8 +653,8 @@ pprInstInfo info = vcat [ptext (sLit "InstInfo:") <+> ppr (idType (iDFunId info) pprInstInfoDetails :: OutputableBndr a => InstInfo a -> SDoc pprInstInfoDetails info = pprInstInfo info $$ nest 2 (details (iBinds info)) where - details (VanillaInst b _) = pprLHsBinds b - details NewTypeDerived = text "Derived from the representation type" + details (VanillaInst b _) = pprLHsBinds b + details (NewTypeDerived _) = text "Derived from the representation type" simpleInstInfoClsTy :: InstInfo a -> (Class, Type) simpleInstInfoClsTy info = case instanceHead (iSpec info) of