Commit 8f8b434c authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Remove redundant HpcMap and HpcSet wrappers around Data.{Map,Set}

parent 4c415f93
...@@ -11,8 +11,8 @@ import Trace.Hpc.Util ...@@ -11,8 +11,8 @@ import Trace.Hpc.Util
import HpcFlags import HpcFlags
import Control.Monad import Control.Monad
import qualified HpcSet as Set import qualified Data.Set as Set
import qualified HpcMap as Map import qualified Data.Map as Map
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
sum_options :: FlagOptSeq sum_options :: FlagOptSeq
......
...@@ -6,8 +6,8 @@ import Trace.Hpc.Util ...@@ -6,8 +6,8 @@ import Trace.Hpc.Util
import HpcFlags import HpcFlags
import qualified HpcSet as Set import qualified Data.Set as Set
import qualified HpcMap as Map import qualified Data.Map as Map
import HpcUtils import HpcUtils
import Data.Tree import Data.Tree
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module HpcFlags where module HpcFlags where
import System.Console.GetOpt import System.Console.GetOpt
import qualified HpcSet as Set import qualified Data.Set as Set
import Data.Char import Data.Char
import Trace.Hpc.Tix import Trace.Hpc.Tix
import Trace.Hpc.Mix import Trace.Hpc.Mix
......
module HpcMap ( module HpcMap ) where
#if __GLASGOW_HASKELL__ < 604
import qualified Data.FiniteMap as Map
#else
import qualified Data.Map as Map
#endif
lookup :: Ord key => key -> Map key elt -> Maybe elt
fromList :: Ord key => [(key,elt)] -> Map key elt
fromListWith :: Ord k => (a -> a -> a) -> [(k, a)] -> Map k a
toList :: Ord key => Map key elt -> [(key,elt)]
#if __GLASGOW_HASKELL__ < 604
type Map key elt = Map.FiniteMap key elt
lookup = flip Map.lookupFM
fromList = Map.listToFM
fromListWith f xs = Map.addListToFM_C f Map.emptyFM xs
toList = Map.fmToList
#else
type Map key elt = Map.Map key elt
lookup = Map.lookup
fromList = Map.fromList
toList = Map.toList
fromListWith = Map.fromListWith
#endif
...@@ -18,7 +18,7 @@ import Data.Maybe(fromJust) ...@@ -18,7 +18,7 @@ import Data.Maybe(fromJust)
import Data.Array import Data.Array
import Data.Monoid import Data.Monoid
import Control.Monad import Control.Monad
import qualified HpcSet as Set import qualified Data.Set as Set
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
......
...@@ -6,7 +6,7 @@ import HpcUtils ...@@ -6,7 +6,7 @@ import HpcUtils
import Trace.Hpc.Tix import Trace.Hpc.Tix
import Trace.Hpc.Mix import Trace.Hpc.Mix
import Trace.Hpc.Util import Trace.Hpc.Util
import HpcMap as Map import qualified Data.Map as Map
import Data.Tree import Data.Tree
overlay_options :: FlagOptSeq overlay_options :: FlagOptSeq
......
...@@ -11,7 +11,7 @@ import HpcFlags ...@@ -11,7 +11,7 @@ import HpcFlags
import Trace.Hpc.Mix import Trace.Hpc.Mix
import Trace.Hpc.Tix import Trace.Hpc.Tix
import Control.Monad hiding (guard) import Control.Monad hiding (guard)
import qualified HpcSet as Set import qualified Data.Set as Set
notExpecting :: String -> a notExpecting :: String -> a
notExpecting s = error ("not expecting "++s) notExpecting s = error ("not expecting "++s)
......
module HpcSet ( module HpcSet ) where
import qualified Data.Set as Set
type Set a = Set.Set a
empty :: Set a
insert :: (Ord a) => a -> Set a -> Set a
member :: (Ord a) => a -> Set a -> Bool
null :: Set a -> Bool
intersection :: Ord a => Set a -> Set a -> Set a
fromList :: Ord a => [a] -> Set a
toList :: Set a -> [a]
union :: Ord a => Set a -> Set a -> Set a
#if __GLASGOW_HASKELL__ < 604
empty = Set.emptySet
insert = flip Set.addToSet
member = Set.elementOf
null = Set.isEmptySet
intersection = Set.intersect
fromList = Set.mkSet
toList = Set.setToList
union = Set.union
#else
empty = Set.empty
insert = Set.insert
member = Set.member
null = Set.null
intersection = Set.intersection
fromList = Set.fromList
toList = Set.toList
union = Set.union
#endif
...@@ -5,7 +5,7 @@ import Trace.Hpc.Tix ...@@ -5,7 +5,7 @@ import Trace.Hpc.Tix
import HpcFlags import HpcFlags
import qualified HpcSet as Set import qualified Data.Set as Set
showtix_options :: FlagOptSeq showtix_options :: FlagOptSeq
showtix_options showtix_options
......
module HpcUtils where module HpcUtils where
import Trace.Hpc.Util import Trace.Hpc.Util
import qualified HpcMap as Map import qualified Data.Map as Map
-- turns \n into ' ' -- turns \n into ' '
-- | grab's the text behind a HpcPos; -- | grab's the text behind a HpcPos;
......
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
# #
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
utils/hpc_dist_MODULES = Main HpcCombine HpcDraft HpcFlags HpcLexer HpcMap \ utils/hpc_dist_MODULES = Main HpcCombine HpcDraft HpcFlags HpcLexer \
HpcMarkup HpcOverlay HpcParser HpcReport HpcSet \ HpcMarkup HpcOverlay HpcParser HpcReport \
HpcShowTix HpcUtils HpcShowTix HpcUtils
utils/hpc_dist_HC_OPTS = -cpp -package hpc utils/hpc_dist_HC_OPTS = -cpp -package hpc
utils/hpc_dist_INSTALL = YES utils/hpc_dist_INSTALL = YES
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment