Massive patch for the first months work adding System FC to GHC #34
[ghc-hetmet.git] / compiler / typecheck / TcRnDriver.lhs
index 7bf2f87..0a4895f 100644 (file)
@@ -48,7 +48,8 @@ import TcRules                ( tcRules )
 import TcForeign       ( tcForeignImports, tcForeignExports )
 import TcInstDcls      ( tcInstDecls1, tcInstDecls2 )
 import TcIface         ( tcExtCoreBindings, tcHiBootIface )
-import IfaceSyn                ( checkBootDecl, tyThingToIfaceDecl, IfaceExtName(..) )
+import MkIface         ( tyThingToIfaceDecl )
+import IfaceSyn                ( checkBootDecl, IfaceExtName(..) )
 import TcSimplify      ( tcSimplifyTop )
 import TcTyClsDecls    ( tcTyAndClassDecls )
 import LoadIface       ( loadOrphanModules )
@@ -112,7 +113,7 @@ import MkId         ( unsafeCoerceId )
 import TyCon           ( tyConName )
 import TysWiredIn      ( mkListTy, unitTy )
 import IdInfo          ( GlobalIdDetails(..) )
-import Kind            ( Kind )
+import {- Kind parts of -} Type                ( Kind, eqKind )
 import Var             ( globaliseId )
 import Name            ( isBuiltInSyntax, isInternalName )
 import OccName         ( isTcOcc )
@@ -124,13 +125,14 @@ import HscTypes           ( InteractiveContext(..),
                          Dependencies(..) )
 import BasicTypes      ( Fixity, RecFlag(..) )
 import SrcLoc          ( unLoc )
+import Data.Maybe      ( isNothing )
 #endif
 
 import FastString      ( mkFastString )
 import Util            ( sortLe )
 import Bag             ( unionBags, snocBag, emptyBag, unitBag, unionManyBags )
 
-import Data.Maybe      ( isJust, isNothing )
+import Data.Maybe      ( isJust )
 \end{code}
 
 
@@ -427,6 +429,7 @@ tc_rn_src_decls boot_details ds
        -- Rename the splice expression, and get its supporting decls
        (rn_splice_expr, splice_fvs) <- rnLExpr splice_expr ;
        failIfErrsM ;   -- Don't typecheck if renaming failed
+       rnDump (ppr rn_splice_expr) ;
 
        -- Execute the splice
        spliced_decls <- tcSpliceDecls rn_splice_expr ;
@@ -994,10 +997,12 @@ tcGhciStmts stmts
                -- then the type checker would instantiate x..z, and we wouldn't
                -- get their *polymorphic* values.  (And we'd get ambiguity errs
                -- if they were overloaded, since they aren't applied to anything.)
-           mk_return ids = nlHsApp (noLoc $ TyApp (nlHsVar ret_id) [ret_ty]) 
+           mk_return ids = nlHsApp (mkHsTyApp ret_id [ret_ty]) 
                                    (noLoc $ ExplicitList unitTy (map mk_item ids)) ;
-           mk_item id = nlHsApp (noLoc $ TyApp (nlHsVar unsafeCoerceId) [idType id, unitTy])
-                                (nlHsVar id) 
+           mk_item id = nlHsApp (noLoc $ unsafeCoerce)
+                                (nlHsVar id)
+            unsafeCoerce x = Cast x (mkUnsafeCoercion [idType id, unitTy]) 
         } ;
 
        -- OK, we're ready to typecheck the stmts