[commit: ghc] master: ModuleSet: Use an actual set instead of map to units (5990016)
git at git.haskell.org
git at git.haskell.org
Sat Jun 11 14:00:47 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/5990016ac87ebc39466b736fb94bba7643e0fc97/ghc
>---------------------------------------------------------------
commit 5990016ac87ebc39466b736fb94bba7643e0fc97
Author: Ömer Sinan Ağacan <omeragacan at gmail.com>
Date: Sat Jun 11 10:01:49 2016 -0400
ModuleSet: Use an actual set instead of map to units
>---------------------------------------------------------------
5990016ac87ebc39466b736fb94bba7643e0fc97
compiler/basicTypes/Module.hs | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/compiler/basicTypes/Module.hs b/compiler/basicTypes/Module.hs
index aa886bb..a80df19 100644
--- a/compiler/basicTypes/Module.hs
+++ b/compiler/basicTypes/Module.hs
@@ -92,7 +92,9 @@ import GHC.PackageDb (BinaryStringRep(..), DbModuleRep(..), DbModule(..))
import Data.Data
import Data.Map (Map)
+import Data.Set (Set)
import qualified Data.Map as Map
+import qualified Data.Set as Set
import qualified FiniteMap as Map
import System.FilePath
@@ -580,7 +582,7 @@ foldModuleEnv :: (a -> b -> b) -> b -> ModuleEnv a -> b
foldModuleEnv f x (ModuleEnv e) = Map.foldRightWithKey (\_ v -> f v) x e
-- | A set of 'Module's
-type ModuleSet = Map Module ()
+type ModuleSet = Set Module
mkModuleSet :: [Module] -> ModuleSet
extendModuleSet :: ModuleSet -> Module -> ModuleSet
@@ -588,11 +590,11 @@ emptyModuleSet :: ModuleSet
moduleSetElts :: ModuleSet -> [Module]
elemModuleSet :: Module -> ModuleSet -> Bool
-emptyModuleSet = Map.empty
-mkModuleSet ms = Map.fromList [(m,()) | m <- ms ]
-extendModuleSet s m = Map.insert m () s
-moduleSetElts = Map.keys
-elemModuleSet = Map.member
+emptyModuleSet = Set.empty
+mkModuleSet = Set.fromList
+extendModuleSet s m = Set.insert m s
+moduleSetElts = Set.toList
+elemModuleSet = Set.member
{-
A ModuleName has a Unique, so we can build mappings of these using
More information about the ghc-commits
mailing list