[make Stat data type use IntBag instead of a Map Int Int
John Meacham <john@repetae.net>**20070523031844] hunk ./Atom.hs 6
-    atomIndex,
hunk ./Atom.hs 10
-    intToAtom,
-    toPackedString
+    toPackedString,
+    atomIndex,
+    unsafeAtomToInt,
+    unsafeIntToAtom,
+    intToAtom
hunk ./Atom.hs 61
+unsafeAtomToInt (Atom x) = x
hunk ./Atom.hs 123
+unsafeIntToAtom :: Int -> Atom
+unsafeIntToAtom x = Atom x
+
hunk ./Stats.hs 52
+import qualified Util.IntBag as IB
hunk ./Stats.hs 149
-newtype Stat = Stat (Map.Map Atom Int)
-    deriving(Eq,Ord)
+newtype Stat = Stat IB.IntBag
+    deriving(Eq,Ord,Monoid)
hunk ./Stats.hs 153
-prependStat name (Stat m) = Stat $ Map.fromList [ (toAtom $ "{" ++ name ++ "}." ++ fromAtom x,y) | (x,y) <- Map.toList m ]
+prependStat name (Stat m) = Stat $ IB.fromList [ (unsafeAtomToInt (toAtom $ "{" ++ name ++ "}." ++ fromAtom (unsafeIntToAtom x)),y) | (x,y) <- IB.toList m ]
hunk ./Stats.hs 156
-    let fs = createForest 0 $ sort [(splitUp (-1) $ fromAtom x,y) | (x,y) <- Map.toList s]
+    let fs = createForest 0 $ sort [(splitUp (-1) $ fromAtom (unsafeIntToAtom x),y) | (x,y) <- IB.toList s]
hunk ./Stats.hs 162
-    let fs = createForest 0 $ Map.toList $ Map.fromListWith (+) [(splitUp n $ fromAtom x,y) | (x,y) <- Map.toList s]
+    let fs = createForest 0 $ [ (x,y) | (x,y) <- Map.toList $ Map.fromListWith (+) [( splitUp n (fromAtom (unsafeIntToAtom x)),y) | (x,y) <- IB.toList s]]
hunk ./Stats.hs 168
-instance Monoid Stat where
-    mempty = Stat Map.empty
-    mappend (Stat a) (Stat b) = Stat $ Map.unionWith (+) a b
+--instance Monoid Stat where
+--    mempty = Stat Map.empty
+--    mappend (Stat a) (Stat b) = Stat $ Map.unionWith (+) a b
hunk ./Stats.hs 180
-tickStat stats (Stat stat) = sequence_  [ ticks stats n a | (a,n) <- Map.toList stat]
+tickStat stats (Stat stat) = sequence_  [ ticks stats n (unsafeIntToAtom a) | (a,n) <- IB.toList stat]
hunk ./Stats.hs 183
-mtickStat (Stat stats)  = sequence_  [ mticks n a | (a,n) <- Map.toList stats]
+mtickStat (Stat stats)  = sequence_  [ mticks n (unsafeIntToAtom a) | (a,n) <- IB.toList stats]
hunk ./Stats.hs 194
-    return (Stat $ Map.fromList ll)
+    return (Stat $ IB.fromList [ (unsafeAtomToInt x,y) | (x,y) <- ll])
hunk ./Stats.hs 251
-    mticks' n k = StatT $ tell (Stat $ Map.singleton k n)
+    mticks' n k = StatT $ tell (Stat $ IB.msingleton (unsafeAtomToInt k) n)
hunk ./Stats.hs 253
-singleton n = Stat $ Map.singleton (toAtom n) 1
+singleton n = Stat $ IB.singleton (unsafeAtomToInt $ toAtom n)
hunk ./Stats.hs 255
-singleStat n k = Stat $ Map.singleton (toAtom k) n
+singleStat n k = Stat $ IB.msingleton (unsafeAtomToInt $ toAtom k) n