Haskell Program Coverage
[ghc-hetmet.git] / compiler / iface / BinIface.hs
index 3e79a39..72ea80d 100644 (file)
@@ -1,7 +1,5 @@
-{-% DrIFT (Automatic class derivations for Haskell) v1.1 %-}
-{-% DrIFT (Automatic class derivations for Haskell) v1.1 %-}
 -- 
---  (c) The University of Glasgow 2002
+--  (c) The University of Glasgow 2002-2006
 -- 
 -- Binary interface file support.
 
@@ -9,45 +7,38 @@ module BinIface ( writeBinIface, readBinIface, v_IgnoreHiWay ) where
 
 #include "HsVersions.h"
 
-import TcRnMonad        ( TcRnIf, ioToIOEnv )
+import TcRnMonad
 import IfaceEnv
 import HscTypes
 import BasicTypes
 import NewDemand
 import IfaceSyn
-import Module           ( ModuleName, mkModule, modulePackageId, moduleName )
+import Module
 import Name
-import OccName          ( OccName )
+import OccName
 import VarEnv
-import InstEnv         ( OverlapFlag(..) )
-import Class           ( DefMeth(..) )
-import DynFlags         ( DynFlags )
-import UniqFM           ( UniqFM, eltsUFM )
-import UniqSupply       ( uniqFromSupply, splitUniqSupply )
+import InstEnv
+import Class
+import DynFlags
+import UniqFM
+import UniqSupply
 import CostCentre
-import StaticFlags     ( opt_HiVersion, v_Build_tag )
-import Type            ( Kind,
-                          isLiftedTypeKind, isUnliftedTypeKind, isOpenTypeKind,
-                         isArgTypeKind, isUbxTupleKind, liftedTypeKind,
-                         unliftedTypeKind, openTypeKind, argTypeKind,  
-                         ubxTupleKind, mkArrowKind, splitFunTy_maybe )
-import PackageConfig    ( PackageId )
+import StaticFlags
+import PackageConfig
 import Panic
 import Binary
-import SrcLoc           ( noSrcLoc )
+import SrcLoc
 import Util
-import ErrUtils         ( debugTraceMsg )
-import Config          ( cGhcUnregisterised )
-import FastMutInt       ( readFastMutInt )
-
-import Data.Word        ( Word32 )
-import Data.Array       ( Array, array, elems, listArray, (!) )
-import DATA_IOREF
-import EXCEPTION       ( throwDyn )
-import Monad           ( when )
+import ErrUtils
+import Config
+import FastMutInt
 import Outputable
 
-#include "HsVersions.h"
+import Data.Word
+import Data.Array
+import Data.IORef
+import Control.Exception
+import Control.Monad
 
 -- ---------------------------------------------------------------------------
 -- Reading and writing binary interface files
@@ -260,6 +251,7 @@ instance Binary ModIface where
                 mi_boot      = is_boot,
                 mi_mod_vers  = mod_vers,
                 mi_orphan    = orphan,
+                mi_finsts    = hasFamInsts,
                 mi_deps      = deps,
                 mi_usages    = usages,
                 mi_exports   = exports,
@@ -278,6 +270,7 @@ instance Binary ModIface where
        put_ bh is_boot
        put_ bh mod_vers
        put_ bh orphan
+       put_ bh hasFamInsts
        lazyPut bh deps
        lazyPut bh usages
        put_ bh exports
@@ -314,6 +307,7 @@ instance Binary ModIface where
        is_boot   <- get bh
        mod_vers  <- get bh
        orphan    <- get bh
+       hasFamInsts <- get bh
        deps      <- lazyGet bh
        usages    <- {-# SCC "bin_usages" #-} lazyGet bh
        exports   <- {-# SCC "bin_exports" #-} get bh
@@ -330,6 +324,7 @@ instance Binary ModIface where
                 mi_boot      = is_boot,
                 mi_mod_vers  = mod_vers,
                 mi_orphan    = orphan,
+                mi_finsts    = hasFamInsts,
                 mi_deps      = deps,
                 mi_usages    = usages,
                 mi_exports   = exports,
@@ -364,11 +359,14 @@ instance Binary Dependencies where
     put_ bh deps = do put_ bh (dep_mods deps)
                      put_ bh (dep_pkgs deps)
                      put_ bh (dep_orphs deps)
+                     put_ bh (dep_finsts deps)
 
     get bh = do ms <- get bh 
                ps <- get bh
                os <- get bh
-               return (Deps { dep_mods = ms, dep_pkgs = ps, dep_orphs = os })
+               fis <- get bh
+               return (Deps { dep_mods = ms, dep_pkgs = ps, dep_orphs = os,
+                              dep_finsts = fis })
 
 instance (Binary name) => Binary (GenAvailInfo name) where
     put_ bh (Avail aa) = do
@@ -1004,6 +1002,15 @@ instance Binary IfaceNote where
     put_ bh (IfaceCoreNote s) = do
             putByte bh 4
             put_ bh s
+    put_ bh (IfaceTickBox m n) = do
+            putByte bh 5
+            put_ bh m
+            put_ bh n
+    put_ bh (IfaceBinaryTickBox m t e) = do
+            putByte bh 6
+            put_ bh m
+            put_ bh t
+            put_ bh e
     get bh = do
            h <- getByte bh
            case h of
@@ -1012,7 +1019,13 @@ instance Binary IfaceNote where
              3 -> do return IfaceInlineMe
               4 -> do ac <- get bh
                       return (IfaceCoreNote ac)
-
+              5 -> do m <- get bh
+                      n <- get bh
+                      return (IfaceTickBox m n)
+              6 -> do m <- get bh
+                      t <- get bh
+                      e <- get bh
+                      return (IfaceBinaryTickBox m t e)
 
 -------------------------------------------------------------------------
 --             IfaceDecl and friends