module BinIface ( writeBinIface ) where
+#include "HsVersions.h"
+
import HscTypes
import BasicTypes
import NewDemand
import StringBuffer ( hGetStringBuffer )
import Panic
import SrcLoc
-
import Binary
-import IOExts ( readIORef )
-import Monad ( when )
-import Exception ( throwDyn )
+import DATA_IOREF ( readIORef )
+import EXCEPTION ( throwDyn )
-#include "HsVersions.h"
+import Monad ( when )
-- BasicTypes
{-! for IPName derive: Binary !-}
put_ bh (vers_module (mi_version iface))
put_ bh (mi_orphan iface)
-- no: mi_boot
- put_ bh (map importVersionNameToOccName (mi_usages iface))
+ lazyPut bh (map importVersionNameToOccName (mi_usages iface))
put_ bh (vers_exports (mi_version iface),
map exportItemToRdrExportItem (mi_exports iface))
put_ bh (declsToVersionedDecls (dcl_tycl (mi_decls iface))
lazyPut bh (vers_rules (mi_version iface), dcl_rules (mi_decls iface))
lazyPut bh (deprecsToIfaceDeprecs (mi_deprecs iface))
- -- Read in an a ParsedIface, not a ModIface. See above.
+ -- Read in as a ParsedIface, not a ModIface. See above.
get bh = error "Binary.get: ModIface"
declsToVersionedDecls :: [RenamedTyClDecl] -> NameEnv Version
put_ bh pkg_name
put_ bh module_ver
put_ bh orphan
- put_ bh usages
+ lazyPut bh usages
put_ bh exports
put_ bh tycl_decls
put_ bh fixities
pkg_name <- get bh
module_ver <- get bh
orphan <- get bh
- usages <- get bh
- exports <- get bh
- tycl_decls <- get bh
- fixities <- get bh
- insts <- get bh
- rules <- lazyGet bh
- deprecs <- lazyGet bh
+ usages <- {-# SCC "bin_usages" #-} lazyGet bh
+ exports <- {-# SCC "bin_exports" #-} get bh
+ tycl_decls <- {-# SCC "bin_tycldecls" #-} get bh
+ fixities <- {-# SCC "bin_fixities" #-} get bh
+ insts <- {-# SCC "bin_insts" #-} get bh
+ rules <- {-# SCC "bin_rules" #-} lazyGet bh
+ deprecs <- {-# SCC "bin_deprecs" #-} lazyGet bh
return (ParsedIface {
pi_mod = module_name,
pi_pkg = pkg_name,
h <- getByte bh
case h of
0 -> do return TopRes
- 1 -> do return RetCPR
+ 1 -> do return RetCPR -- Really use RetCPR even if -fcpr-off
+ -- The wrapper was generated for CPR in
+ -- the imported module!
_ -> do return BotRes
instance Binary StrictSig where
ac <- get bh
return (HsTupCon aa ab ac)
+instance (Binary name) => Binary (HsTyOp name) where
+ put_ bh HsArrow = putByte bh 0
+ put_ bh (HsTyOp n) = do putByte bh 1
+ put_ bh n
+
+ get bh = do h <- getByte bh
+ case h of
+ 0 -> return HsArrow
+ 1 -> do a <- get bh
+ return (HsTyOp a)
+
instance (Binary name) => Binary (HsType name) where
put_ bh (HsForAllTy aa ab ac) = do
putByte bh 0