diff options
author | Ian Lynagh <igloo@earth.li> | 2010-09-14 20:17:03 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2010-09-14 20:17:03 +0000 |
commit | e95ee1f718c6915c478005aad8af81705357d6ab (patch) | |
tree | 0b19fdfd9d02b195b371e0f6ef8d413936113519 /compiler/simplStg | |
parent | 83a8fc9f6e04436784693a2188a58eac9c3e9664 (diff) | |
download | haskell-e95ee1f718c6915c478005aad8af81705357d6ab.tar.gz |
Remove (most of) the FiniteMap wrapper
We still have
insertList, insertListWith, deleteList
which aren't in Data.Map, and
foldRightWithKey
which works around the fold(r)WithKey addition and deprecation.
Diffstat (limited to 'compiler/simplStg')
-rw-r--r-- | compiler/simplStg/StgStats.lhs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/compiler/simplStg/StgStats.lhs b/compiler/simplStg/StgStats.lhs index 25c988d52b..74a4fc3cbf 100644 --- a/compiler/simplStg/StgStats.lhs +++ b/compiler/simplStg/StgStats.lhs @@ -34,8 +34,10 @@ module StgStats ( showStgStats ) where import StgSyn -import FiniteMap ( emptyFM, plusFM_C, unitFM, fmToList, FiniteMap ) import Id (Id) + +import Data.Map (Map) +import qualified Data.Map as Map \end{code} \begin{code} @@ -54,24 +56,24 @@ data CounterType deriving (Eq, Ord) type Count = Int -type StatEnv = FiniteMap CounterType Count +type StatEnv = Map CounterType Count \end{code} \begin{code} emptySE :: StatEnv -emptySE = emptyFM +emptySE = Map.empty combineSE :: StatEnv -> StatEnv -> StatEnv -combineSE = plusFM_C (+) +combineSE = Map.unionWith (+) combineSEs :: [StatEnv] -> StatEnv combineSEs = foldr combineSE emptySE countOne :: CounterType -> StatEnv -countOne c = unitFM c 1 +countOne c = Map.singleton c 1 countN :: CounterType -> Int -> StatEnv -countN = unitFM +countN = Map.singleton \end{code} %************************************************************************ @@ -85,7 +87,7 @@ showStgStats :: [StgBinding] -> String showStgStats prog = "STG Statistics:\n\n" - ++ concat (map showc (fmToList (gatherStgStats prog))) + ++ concat (map showc (Map.toList (gatherStgStats prog))) where showc (x,n) = (showString (s x) . shows n) "\n" |