[project @ 2002-09-06 14:40:28 by simonmar]
[ghc-hetmet.git] / ghc / compiler / typecheck / TcModule.lhs
index 6b76101..342c623 100644 (file)
@@ -18,7 +18,7 @@ import HsSyn          ( HsBinds(..), MonoBinds(..), HsDecl(..), HsExpr(..),
                          isSourceInstDecl, mkSimpleMatch, placeHolderType, isCoreDecl
                        )
 import PrelNames       ( ioTyConName, printName,
-                         returnIOName, bindIOName, failIOName, thenIOName, runMainName, 
+                         returnIOName, bindIOName, failIOName, thenIOName, runIOName, 
                          dollarMainName, itName
                        )
 import MkId            ( unsafeCoerceId )
@@ -213,8 +213,8 @@ tc_stmts names stmts
     traceTc (text "tcs 4") `thenNF_Tc_`
 
     returnTc (mkHsLet const_binds $
-             HsDoOut DoExpr tc_stmts io_ids
-                     (mkTyConApp ioTyCon [mkListTy unitTy]) noSrcLoc,
+             HsDo DoExpr tc_stmts io_ids
+                  (mkTyConApp ioTyCon [mkListTy unitTy]) noSrcLoc,
              ids)
   where
     combine stmt (ids, stmts) = (ids, stmt:stmts)
@@ -751,10 +751,10 @@ We must check that in module Main,
        b) Main.main :: forall a1...an. IO t,  for some type t
 
 Then we build
-       $main = PrelTopHandler.runMain Main.main
+       $main = GHC.TopHandler.runIO Main.main
 
 The function
-  PrelTopHandler :: IO a -> IO ()
+  GHC.TopHandler.runIO :: IO a -> IO a
 catches the top level exceptions.  
 It accepts a Main.main of any type (IO a).
 
@@ -770,17 +770,17 @@ tcCheckMain (Just main_name)
     newTyVarTy liftedTypeKind          `thenNF_Tc` \ ty ->
     tcMonoExpr rhs ty                  `thenTc` \ (main_expr, lie) ->
     zonkTcType ty                      `thenNF_Tc` \ ty ->
-    ASSERT( is_io_unit ty )
+    ASSERT( is_io ty )
     let
        dollar_main_id = setIdLocalExported (mkLocalId dollarMainName ty)
     in
     returnTc (VarMonoBind dollar_main_id main_expr, lie)
   where
-    rhs = HsApp (HsVar runMainName) (HsVar main_name)
+    rhs = HsApp (HsVar runIOName) (HsVar main_name)
 
-is_io_unit :: Type -> Bool     -- True for IO ()
-is_io_unit tau = case tcSplitTyConApp_maybe tau of
-                  Just (tc, [arg]) -> getName tc == ioTyConName && isUnitTy arg
+is_io :: Type -> Bool  -- True for IO a
+is_io tau = case tcSplitTyConApp_maybe tau of
+                  Just (tc, [_]) -> getName tc == ioTyConName
                   other            -> False
 
 mainCtxt = ptext SLIT("When checking the type of 'main'")