[project @ 2002-11-04 15:33:29 by simonpj]
[ghc-hetmet.git] / ghc / compiler / typecheck / TcExpr.lhs
index 89b7d9b..9b913d8 100644 (file)
@@ -11,6 +11,7 @@ module TcExpr ( tcExpr, tcExpr_id, tcMonoExpr ) where
 #ifdef GHCI    /* Only if bootstrapped */
 import {-# SOURCE #-}  TcSplice( tcSpliceExpr, tcBracket )
 import HsSyn           ( HsReify(..), ReifyFlavour(..) )
+import TcType          ( isTauTy )
 import TcEnv           ( bracketOK, tcMetaTy, tcLookupGlobal,
                          wellStaged, metaLevel )
 import TcSimplify      ( tcSimplifyBracket )
@@ -18,16 +19,14 @@ import Name         ( isExternalName )
 import qualified DsMeta
 #endif
 
-import HsSyn           ( HsExpr(..), HsLit(..), ArithSeqInfo(..),
-                         mkMonoBind, recBindFields
-                       )
+import HsSyn           ( HsExpr(..), HsLit(..), ArithSeqInfo(..), recBindFields )
 import RnHsSyn         ( RenamedHsExpr, RenamedRecordBinds )
 import TcHsSyn         ( TcExpr, TcRecordBinds, hsLitType, mkHsDictApp, mkHsTyApp, mkHsLet )
 import TcRnMonad
 import TcUnify         ( tcSubExp, tcGen, (<$>),
                          unifyTauTy, unifyFunTy, unifyListTy, unifyPArrTy,
                          unifyTupleTy )
-import BasicTypes      ( RecFlag(..),  isMarkedStrict )
+import BasicTypes      ( isMarkedStrict )
 import Inst            ( InstOrigin(..), 
                          newOverloadedLit, newMethodFromName, newIPDict,
                          newDicts, newMethodWithGivenTy, 
@@ -40,7 +39,6 @@ import TcEnv          ( tcLookupClass, tcLookupGlobal_maybe, tcLookupIdLvl,
 import TcMatches       ( tcMatchesCase, tcMatchLambda, tcDoStmts )
 import TcMonoType      ( tcHsSigType, UserTypeCtxt(..) )
 import TcPat           ( badFieldCon )
-import TcSimplify      ( tcSimplifyIPs )
 import TcMType         ( tcInstTyVars, tcInstType, newHoleTyVarTy, zapToType,
                          newTyVarTy, newTyVarTys, zonkTcType, readHoleResult )
 import TcType          ( TcType, TcSigmaType, TcRhoType, TyVarDetails(VanillaTv),
@@ -235,11 +233,9 @@ tcMonoExpr in_expr@(OpApp arg1 op fix arg2) res_ty
 \begin{code}
 tcMonoExpr (HsLet binds expr) res_ty
   = tcBindsAndThen
-       combiner
+       HsLet
        binds                   -- Bindings to check
        (tcMonoExpr expr res_ty)
-  where
-    combiner is_rec bind expr = HsLet (mkMonoBind bind [] is_rec) expr
 
 tcMonoExpr in_expr@(HsCase scrut matches src_loc) res_ty
   = addSrcLoc src_loc                  $
@@ -657,39 +653,12 @@ tcMonoExpr (HsReify (Reify flavour name)) res_ty
     returnM (HsReify (ReifyOut flavour name))
   where
     tycon_name = case flavour of
-                  ReifyDecl -> DsMeta.decTyConName
-                  ReifyType -> DsMeta.typTyConName
+                  ReifyDecl -> DsMeta.declTyConName
+                  ReifyType -> DsMeta.typeTyConName
                   ReifyFixity -> pprPanic "tcMonoExpr: cant do reifyFixity yet" (ppr name)
 #endif GHCI
 \end{code}
 
-%************************************************************************
-%*                                                                     *
-\subsection{Implicit Parameter bindings}
-%*                                                                     *
-%************************************************************************
-
-\begin{code}
-tcMonoExpr (HsWith expr binds is_with) res_ty
-  = getLIE (tcMonoExpr expr res_ty)    `thenM` \ (expr', expr_lie) ->
-    mapAndUnzipM tc_ip_bind binds      `thenM` \ (avail_ips, binds') ->
-
-       -- If the binding binds ?x = E, we  must now 
-       -- discharge any ?x constraints in expr_lie
-    tcSimplifyIPs avail_ips expr_lie   `thenM` \ dict_binds ->
-    let
-       expr'' = HsLet (mkMonoBind dict_binds [] Recursive) expr'
-    in
-    returnM (HsWith expr'' binds' is_with)
-  where
-    tc_ip_bind (ip, expr)
-      = newTyVarTy openTypeKind                `thenM` \ ty ->
-       getSrcLocM                      `thenM` \ loc ->
-       newIPDict (IPBind ip) ip ty     `thenM` \ (ip', ip_inst) ->
-       tcMonoExpr expr ty              `thenM` \ expr' ->
-       returnM (ip_inst, (ip', expr'))
-\end{code}
-
 
 %************************************************************************
 %*                                                                     *