[project @ 2005-01-18 12:18:11 by simonpj]
[ghc-hetmet.git] / ghc / compiler / utils / Binary.hs
index 90c7e53..962531f 100644 (file)
@@ -56,6 +56,7 @@ import Unique
 import Panic
 import UniqFM
 import FastMutInt
+import PackageConfig           ( PackageId, packageIdFS, fsToPackageId )
 
 #if __GLASGOW_HASKELL__ < 503
 import DATA_IOREF
@@ -749,6 +750,10 @@ getFS bh = do
   (BA ba) <- getByteArray bh (I# l)
   return $! (mkFastSubStringBA# ba 0# l)
 
+instance Binary PackageId where
+  put_ bh pid = put_ bh (packageIdFS pid)
+  get bh = do { fs <- get bh; return (fsToPackageId fs) }
+
 instance Binary FastString where
   put_ bh f@(FastString id l ba) =
     case getUserData bh of {