[project @ 2005-07-08 15:05:15 by simonpj]
[ghc-hetmet.git] / ghc / compiler / typecheck / TcInstDcls.lhs
index dcf8986..c08dc7a 100644 (file)
@@ -15,7 +15,7 @@ import TcClassDcl     ( tcMethodBind, mkMethodBind, badMethodErr,
 import TcRnMonad       
 import TcMType         ( tcSkolSigType, checkValidTheta, checkValidInstHead, instTypeErr, 
                          checkAmbiguity, SourceTyCtxt(..) )
-import TcType          ( mkClassPred, tyVarsOfType, 
+import TcType          ( mkClassPred, tyVarsOfType, tcSplitInstHeadTy_maybe,
                          tcSplitSigmaTy, tcSplitDFunHead, mkTyVarTys,
                          SkolemInfo(InstSkol), tcSplitDFunTy, pprClassPred )
 import Inst            ( tcInstClassOp, newDicts, instToId, showLIE, 
@@ -227,7 +227,7 @@ tcLocalInstDecl1 decl@(L loc (InstDecl poly_ty binds uprags))
 
 \begin{code}
 tcInstDecls2 :: [LTyClDecl Name] -> [InstInfo] 
-            -> TcM (TcLclEnv, LHsBinds Id)
+            -> TcM (LHsBinds Id, TcLclEnv)
 -- (a) From each class declaration, 
 --     generate any default-method bindings
 -- (b) From each instance decl
@@ -243,9 +243,10 @@ tcInstDecls2 tycl_decls inst_decls
        ; inst_binds_s <- mappM tcInstDecl2 inst_decls
 
                -- Done
-       ; tcl_env <- getLclEnv
-       ; returnM (tcl_env, unionManyBags dm_binds_s    `unionBags`
-                           unionManyBags inst_binds_s) }
+       ; let binds = unionManyBags dm_binds_s `unionBags` 
+                     unionManyBags inst_binds_s
+       ; tcl_env <- getLclEnv          -- Default method Ids in here
+       ; returnM (binds, tcl_env) }
 \end{code}
 
 ======= New documentation starts here (Sept 92)         ==============