[make Info type ids not depend on the exact format of TypeRep, reduce size of type ids from 32 to 8 bits.
John Meacham <john@repetae.net>**20120307014613
 Ignore-this: c2243c0c28122f03a4b869c28a449d8d
] hunk ./src/Ho/Binary.hs 22
-current_version = 10
+current_version = 11
hunk ./src/Info/Binary.hs 12
-import StringTable.Atom(HasHash(..))
hunk ./src/Info/Binary.hs 20
-createTyp :: Typeable a => a -> Word32
-createTyp x = hash32 $ (show (typeOf x))
hunk ./src/Info/Binary.hs 22
-cb x = (createTyp x, Binable x)
+cb n x = (n, Binable x, typeOf x)
hunk ./src/Info/Binary.hs 24
-binTable :: Map.Map Word32 Binable
-binTable = Map.fromList [
-    cb (u :: Properties),
-    cb (u :: E.CPR.Val),
-    cb (u :: FfiExport),
-    cb (u :: E.Demand.DemandSignature)
+-- Note: the numbers here are part of the ABI of the serialized files.
+-- If you change them then you must change the ABI version number in
+-- Ho.Binary and invalidate all old files.
+binTableValues =  [
+    cb 1 (u :: Properties),
+    cb 2 (u :: E.CPR.Val),
+    cb 3 (u :: FfiExport),
+    cb 4 (u :: E.Demand.DemandSignature)
hunk ./src/Info/Binary.hs 34
-putDyn :: (Word32,Dynamic,Binable) -> Put
+binTable :: Map.Map Word8 Binable
+binTable = Map.fromList [ (n,x) | (n,x,_) <- binTableValues ]
+
+revBinTable :: [(TypeRep,(Word8,Binable))]
+revBinTable = [ (t,(n,x)) | (n,x,t) <- binTableValues ]
+
+putDyn :: (Word8,Dynamic,Binable) -> Put
hunk ./src/Info/Binary.hs 45
--- = case Map.lookup (packString (show d)) of
---    Just (Binable (x::a)) -> put_ h (case fromDynamic d of Just x -> x :: a)
---    Nothing -> return ()
-
hunk ./src/Info/Binary.hs 46
-    (ps::Word32) <- get
+    (ps::Word8) <- get
hunk ./src/Info/Binary.hs 64
-            let ps = hash32 $ (show $ entryType d)
-            case Map.lookup ps binTable of
-              Just x  -> return (ps,entryThing d,x)
+            case Prelude.lookup (entryType d) revBinTable of
+              Just (ps,x)  -> return (ps,entryThing d,x)
hunk ./src/Info/Binary.hs 75
-    return (Info  [ x | x <- xs])
+    return (Info xs)