74b15bcd3ae17c883b912845807dfa514a1dd1e0
[ghc.git] / compiler / basicTypes / Module.hs
1 {-
2 (c) The University of Glasgow, 2004-2006
3
4
5 Module
6 ~~~~~~~~~~
7 Simply the name of a module, represented as a FastString.
8 These are Uniquable, hence we can build Maps with Modules as
9 the keys.
10 -}
11
12 {-# LANGUAGE RecordWildCards #-}
13 {-# LANGUAGE MultiParamTypeClasses #-}
14
15 module Module
16 (
17 -- * The ModuleName type
18 ModuleName,
19 pprModuleName,
20 moduleNameFS,
21 moduleNameString,
22 moduleNameSlashes, moduleNameColons,
23 moduleStableString,
24 mkModuleName,
25 mkModuleNameFS,
26 stableModuleNameCmp,
27
28 -- * The UnitId type
29 UnitId,
30 fsToUnitId,
31 unitIdFS,
32 stringToUnitId,
33 unitIdString,
34 stableUnitIdCmp,
35
36 -- * Wired-in UnitIds
37 -- $wired_in_packages
38 primUnitId,
39 integerUnitId,
40 baseUnitId,
41 rtsUnitId,
42 thUnitId,
43 dphSeqUnitId,
44 dphParUnitId,
45 mainUnitId,
46 thisGhcUnitId,
47 holeUnitId, isHoleModule,
48 interactiveUnitId, isInteractiveModule,
49 wiredInUnitIds,
50
51 -- * The Module type
52 Module(Module),
53 moduleUnitId, moduleName,
54 pprModule,
55 mkModule,
56 stableModuleCmp,
57 HasModule(..),
58 ContainsModule(..),
59
60 -- * The ModuleLocation type
61 ModLocation(..),
62 addBootSuffix, addBootSuffix_maybe, addBootSuffixLocn,
63
64 -- * Module mappings
65 ModuleEnv,
66 elemModuleEnv, extendModuleEnv, extendModuleEnvList,
67 extendModuleEnvList_C, plusModuleEnv_C,
68 delModuleEnvList, delModuleEnv, plusModuleEnv, lookupModuleEnv,
69 lookupWithDefaultModuleEnv, mapModuleEnv, mkModuleEnv, emptyModuleEnv,
70 moduleEnvKeys, moduleEnvElts, moduleEnvToList,
71 unitModuleEnv, isEmptyModuleEnv,
72 extendModuleEnvWith, filterModuleEnv,
73
74 -- * ModuleName mappings
75 ModuleNameEnv, DModuleNameEnv,
76
77 -- * Sets of Modules
78 ModuleSet,
79 emptyModuleSet, mkModuleSet, moduleSetElts, extendModuleSet, elemModuleSet
80 ) where
81
82 import Config
83 import Outputable
84 import Unique
85 import UniqFM
86 import UniqDFM
87 import FastString
88 import Binary
89 import Util
90 import {-# SOURCE #-} Packages
91 import GHC.PackageDb (BinaryStringRep(..), DbModuleRep(..), DbModule(..))
92
93 import Data.Data
94 import Data.Map (Map)
95 import Data.Set (Set)
96 import qualified Data.Map as Map
97 import qualified Data.Set as Set
98 import qualified FiniteMap as Map
99 import System.FilePath
100
101 -- Note [The identifier lexicon]
102 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
103 -- Package keys, installed package IDs, ABI hashes, package names,
104 -- versions, there are a *lot* of different identifiers for closely
105 -- related things. What do they all mean? Here's what. (See also
106 -- https://ghc.haskell.org/trac/ghc/wiki/Commentary/Packages/Concepts )
107 --
108 -- THE IMPORTANT ONES
109 --
110 -- ComponentId: An opaque identifier provided by Cabal, which should
111 -- uniquely identify such things as the package name, the package
112 -- version, the name of the component, the hash of the source code
113 -- tarball, the selected Cabal flags, GHC flags, direct dependencies of
114 -- the component. These are very similar to InstalledPackageId, but
115 -- an 'InstalledPackageId' implies that it identifies a package, while
116 -- a package may install multiple components with different
117 -- 'ComponentId's.
118 -- - Same as Distribution.Package.ComponentId
119 --
120 -- UnitId: A ComponentId + a mapping from hole names (ModuleName) to
121 -- Modules. This is how the compiler identifies instantatiated
122 -- components, and also is the main identifier by which GHC identifies
123 -- things.
124 -- - When Backpack is not being used, UnitId = ComponentId.
125 -- this means a useful fiction for end-users is that there are
126 -- only ever ComponentIds, and some ComponentIds happen to have
127 -- more information (UnitIds).
128 -- - Same as Language.Haskell.TH.Syntax:PkgName, see
129 -- https://ghc.haskell.org/trac/ghc/ticket/10279
130 -- - The same as PackageKey in GHC 7.10 (we renamed it because
131 -- they don't necessarily identify packages anymore.)
132 -- - Same as -this-package-key/-package-name flags
133 --
134 -- Module: A UnitId + ModuleName. This is how the compiler identifies
135 -- modules (e.g. a Name is a Module + OccName)
136 -- - Same as Language.Haskell.TH.Syntax:Module
137 --
138 -- THE LESS IMPORTANT ONES
139 --
140 -- PackageName: The "name" field in a Cabal file, something like "lens".
141 -- - Same as Distribution.Package.PackageName
142 -- - DIFFERENT FROM Language.Haskell.TH.Syntax:PkgName, see
143 -- https://ghc.haskell.org/trac/ghc/ticket/10279
144 -- - DIFFERENT FROM -package-name flag
145 -- - DIFFERENT FROM the 'name' field in an installed package
146 -- information. This field could more accurately be described
147 -- as a munged package name: when it's for the main library
148 -- it is the same as the package name, but if it's an internal
149 -- library it's a munged combination of the package name and
150 -- the component name.
151 --
152 -- LEGACY ONES
153 --
154 -- InstalledPackageId: This is what we used to call ComponentId.
155 -- It's a still pretty useful concept for packages that have only
156 -- one library; in that case the logical InstalledPackageId =
157 -- ComponentId. Also, the Cabal nix-local-build continues to
158 -- compute an InstalledPackageId which is then forcibly used
159 -- for all components in a package. This means that if a dependency
160 -- from one component in a package changes, the InstalledPackageId
161 -- changes: you don't get as fine-grained dependency tracking,
162 -- but it means your builds are hermetic. Eventually, Cabal will
163 -- deal completely in components and we can get rid of this.
164 --
165 -- PackageKey: This is what we used to call UnitId. We ditched
166 -- "Package" from the name when we realized that you might want to
167 -- assign different "PackageKeys" to components from the same package.
168 -- (For a brief, non-released period of time, we also called these
169 -- UnitKeys).
170
171 {-
172 ************************************************************************
173 * *
174 \subsection{Module locations}
175 * *
176 ************************************************************************
177 -}
178
179 -- | Where a module lives on the file system: the actual locations
180 -- of the .hs, .hi and .o files, if we have them
181 data ModLocation
182 = ModLocation {
183 ml_hs_file :: Maybe FilePath,
184 -- The source file, if we have one. Package modules
185 -- probably don't have source files.
186
187 ml_hi_file :: FilePath,
188 -- Where the .hi file is, whether or not it exists
189 -- yet. Always of form foo.hi, even if there is an
190 -- hi-boot file (we add the -boot suffix later)
191
192 ml_obj_file :: FilePath
193 -- Where the .o file is, whether or not it exists yet.
194 -- (might not exist either because the module hasn't
195 -- been compiled yet, or because it is part of a
196 -- package with a .a file)
197 } deriving Show
198
199 instance Outputable ModLocation where
200 ppr = text . show
201
202 {-
203 For a module in another package, the hs_file and obj_file
204 components of ModLocation are undefined.
205
206 The locations specified by a ModLocation may or may not
207 correspond to actual files yet: for example, even if the object
208 file doesn't exist, the ModLocation still contains the path to
209 where the object file will reside if/when it is created.
210 -}
211
212 addBootSuffix :: FilePath -> FilePath
213 -- ^ Add the @-boot@ suffix to .hs, .hi and .o files
214 addBootSuffix path = path ++ "-boot"
215
216 addBootSuffix_maybe :: Bool -> FilePath -> FilePath
217 -- ^ Add the @-boot@ suffix if the @Bool@ argument is @True@
218 addBootSuffix_maybe is_boot path
219 | is_boot = addBootSuffix path
220 | otherwise = path
221
222 addBootSuffixLocn :: ModLocation -> ModLocation
223 -- ^ Add the @-boot@ suffix to all file paths associated with the module
224 addBootSuffixLocn locn
225 = locn { ml_hs_file = fmap addBootSuffix (ml_hs_file locn)
226 , ml_hi_file = addBootSuffix (ml_hi_file locn)
227 , ml_obj_file = addBootSuffix (ml_obj_file locn) }
228
229 {-
230 ************************************************************************
231 * *
232 \subsection{The name of a module}
233 * *
234 ************************************************************************
235 -}
236
237 -- | A ModuleName is essentially a simple string, e.g. @Data.List@.
238 newtype ModuleName = ModuleName FastString
239
240 instance Uniquable ModuleName where
241 getUnique (ModuleName nm) = getUnique nm
242
243 instance Eq ModuleName where
244 nm1 == nm2 = getUnique nm1 == getUnique nm2
245
246 -- Warning: gives an ordering relation based on the uniques of the
247 -- FastStrings which are the (encoded) module names. This is _not_
248 -- a lexicographical ordering.
249 instance Ord ModuleName where
250 nm1 `compare` nm2 = getUnique nm1 `compare` getUnique nm2
251
252 instance Outputable ModuleName where
253 ppr = pprModuleName
254
255 instance Binary ModuleName where
256 put_ bh (ModuleName fs) = put_ bh fs
257 get bh = do fs <- get bh; return (ModuleName fs)
258
259 instance BinaryStringRep ModuleName where
260 fromStringRep = mkModuleNameFS . mkFastStringByteString
261 toStringRep = fastStringToByteString . moduleNameFS
262
263 instance Data ModuleName where
264 -- don't traverse?
265 toConstr _ = abstractConstr "ModuleName"
266 gunfold _ _ = error "gunfold"
267 dataTypeOf _ = mkNoRepType "ModuleName"
268
269 stableModuleNameCmp :: ModuleName -> ModuleName -> Ordering
270 -- ^ Compares module names lexically, rather than by their 'Unique's
271 stableModuleNameCmp n1 n2 = moduleNameFS n1 `compare` moduleNameFS n2
272
273 pprModuleName :: ModuleName -> SDoc
274 pprModuleName (ModuleName nm) =
275 getPprStyle $ \ sty ->
276 if codeStyle sty
277 then ztext (zEncodeFS nm)
278 else ftext nm
279
280 moduleNameFS :: ModuleName -> FastString
281 moduleNameFS (ModuleName mod) = mod
282
283 moduleNameString :: ModuleName -> String
284 moduleNameString (ModuleName mod) = unpackFS mod
285
286 -- | Get a string representation of a 'Module' that's unique and stable
287 -- across recompilations.
288 -- eg. "$aeson_70dylHtv1FFGeai1IoxcQr$Data.Aeson.Types.Internal"
289 moduleStableString :: Module -> String
290 moduleStableString Module{..} =
291 "$" ++ unitIdString moduleUnitId ++ "$" ++ moduleNameString moduleName
292
293 mkModuleName :: String -> ModuleName
294 mkModuleName s = ModuleName (mkFastString s)
295
296 mkModuleNameFS :: FastString -> ModuleName
297 mkModuleNameFS s = ModuleName s
298
299 -- |Returns the string version of the module name, with dots replaced by slashes.
300 --
301 moduleNameSlashes :: ModuleName -> String
302 moduleNameSlashes = dots_to_slashes . moduleNameString
303 where dots_to_slashes = map (\c -> if c == '.' then pathSeparator else c)
304
305 -- |Returns the string version of the module name, with dots replaced by underscores.
306 --
307 moduleNameColons :: ModuleName -> String
308 moduleNameColons = dots_to_colons . moduleNameString
309 where dots_to_colons = map (\c -> if c == '.' then ':' else c)
310
311 {-
312 ************************************************************************
313 * *
314 \subsection{A fully qualified module}
315 * *
316 ************************************************************************
317 -}
318
319 -- | A Module is a pair of a 'UnitId' and a 'ModuleName'.
320 data Module = Module {
321 moduleUnitId :: !UnitId, -- pkg-1.0
322 moduleName :: !ModuleName -- A.B.C
323 }
324 deriving (Eq, Ord)
325
326 instance Uniquable Module where
327 getUnique (Module p n) = getUnique (unitIdFS p `appendFS` moduleNameFS n)
328
329 instance Outputable Module where
330 ppr = pprModule
331
332 instance Binary Module where
333 put_ bh (Module p n) = put_ bh p >> put_ bh n
334 get bh = do p <- get bh; n <- get bh; return (Module p n)
335
336 instance Data Module where
337 -- don't traverse?
338 toConstr _ = abstractConstr "Module"
339 gunfold _ _ = error "gunfold"
340 dataTypeOf _ = mkNoRepType "Module"
341
342 -- | This gives a stable ordering, as opposed to the Ord instance which
343 -- gives an ordering based on the 'Unique's of the components, which may
344 -- not be stable from run to run of the compiler.
345 stableModuleCmp :: Module -> Module -> Ordering
346 stableModuleCmp (Module p1 n1) (Module p2 n2)
347 = (p1 `stableUnitIdCmp` p2) `thenCmp`
348 (n1 `stableModuleNameCmp` n2)
349
350 mkModule :: UnitId -> ModuleName -> Module
351 mkModule = Module
352
353 pprModule :: Module -> SDoc
354 pprModule mod@(Module p n) =
355 pprPackagePrefix p mod <> pprModuleName n
356
357 pprPackagePrefix :: UnitId -> Module -> SDoc
358 pprPackagePrefix p mod = getPprStyle doc
359 where
360 doc sty
361 | codeStyle sty =
362 if p == mainUnitId
363 then empty -- never qualify the main package in code
364 else ztext (zEncodeFS (unitIdFS p)) <> char '_'
365 | qualModule sty mod = ppr (moduleUnitId mod) <> char ':'
366 -- the PrintUnqualified tells us which modules have to
367 -- be qualified with package names
368 | otherwise = empty
369
370 class ContainsModule t where
371 extractModule :: t -> Module
372
373 class HasModule m where
374 getModule :: m Module
375
376 instance DbModuleRep UnitId ModuleName Module where
377 fromDbModule (DbModule uid mod_name) = mkModule uid mod_name
378 toDbModule mod = DbModule (moduleUnitId mod) (moduleName mod)
379
380 {-
381 ************************************************************************
382 * *
383 \subsection{UnitId}
384 * *
385 ************************************************************************
386 -}
387
388 -- | A string which uniquely identifies a package. For wired-in packages,
389 -- it is just the package name, but for user compiled packages, it is a hash.
390 -- ToDo: when the key is a hash, we can do more clever things than store
391 -- the hex representation and hash-cons those strings.
392 newtype UnitId = PId FastString deriving Eq
393 -- here to avoid module loops with PackageConfig
394
395 instance Uniquable UnitId where
396 getUnique pid = getUnique (unitIdFS pid)
397
398 -- Note: *not* a stable lexicographic ordering, a faster unique-based
399 -- ordering.
400 instance Ord UnitId where
401 nm1 `compare` nm2 = getUnique nm1 `compare` getUnique nm2
402
403 instance Data UnitId where
404 -- don't traverse?
405 toConstr _ = abstractConstr "UnitId"
406 gunfold _ _ = error "gunfold"
407 dataTypeOf _ = mkNoRepType "UnitId"
408
409 stableUnitIdCmp :: UnitId -> UnitId -> Ordering
410 -- ^ Compares package ids lexically, rather than by their 'Unique's
411 stableUnitIdCmp p1 p2 = unitIdFS p1 `compare` unitIdFS p2
412
413 instance Outputable UnitId where
414 ppr pk = getPprStyle $ \sty -> sdocWithDynFlags $ \dflags ->
415 case unitIdPackageIdString dflags pk of
416 Nothing -> ftext (unitIdFS pk)
417 Just pkg -> text pkg
418 -- Don't bother qualifying if it's wired in!
419 <> (if qualPackage sty pk && not (pk `elem` wiredInUnitIds)
420 then char '@' <> ftext (unitIdFS pk)
421 else empty)
422
423 instance Binary UnitId where
424 put_ bh pid = put_ bh (unitIdFS pid)
425 get bh = do { fs <- get bh; return (fsToUnitId fs) }
426
427 instance BinaryStringRep UnitId where
428 fromStringRep = fsToUnitId . mkFastStringByteString
429 toStringRep = fastStringToByteString . unitIdFS
430
431 fsToUnitId :: FastString -> UnitId
432 fsToUnitId = PId
433
434 unitIdFS :: UnitId -> FastString
435 unitIdFS (PId fs) = fs
436
437 stringToUnitId :: String -> UnitId
438 stringToUnitId = fsToUnitId . mkFastString
439
440 unitIdString :: UnitId -> String
441 unitIdString = unpackFS . unitIdFS
442
443
444 -- -----------------------------------------------------------------------------
445 -- $wired_in_packages
446 -- Certain packages are known to the compiler, in that we know about certain
447 -- entities that reside in these packages, and the compiler needs to
448 -- declare static Modules and Names that refer to these packages. Hence
449 -- the wired-in packages can't include version numbers, since we don't want
450 -- to bake the version numbers of these packages into GHC.
451 --
452 -- So here's the plan. Wired-in packages are still versioned as
453 -- normal in the packages database, and you can still have multiple
454 -- versions of them installed. However, for each invocation of GHC,
455 -- only a single instance of each wired-in package will be recognised
456 -- (the desired one is selected via @-package@\/@-hide-package@), and GHC
457 -- will use the unversioned 'UnitId' below when referring to it,
458 -- including in .hi files and object file symbols. Unselected
459 -- versions of wired-in packages will be ignored, as will any other
460 -- package that depends directly or indirectly on it (much as if you
461 -- had used @-ignore-package@).
462
463 -- Make sure you change 'Packages.findWiredInPackages' if you add an entry here
464
465 integerUnitId, primUnitId,
466 baseUnitId, rtsUnitId,
467 thUnitId, dphSeqUnitId, dphParUnitId,
468 mainUnitId, thisGhcUnitId, interactiveUnitId :: UnitId
469 primUnitId = fsToUnitId (fsLit "ghc-prim")
470 integerUnitId = fsToUnitId (fsLit n)
471 where
472 n = case cIntegerLibraryType of
473 IntegerGMP -> "integer-gmp"
474 IntegerSimple -> "integer-simple"
475 baseUnitId = fsToUnitId (fsLit "base")
476 rtsUnitId = fsToUnitId (fsLit "rts")
477 thUnitId = fsToUnitId (fsLit "template-haskell")
478 dphSeqUnitId = fsToUnitId (fsLit "dph-seq")
479 dphParUnitId = fsToUnitId (fsLit "dph-par")
480 thisGhcUnitId = fsToUnitId (fsLit "ghc")
481 interactiveUnitId = fsToUnitId (fsLit "interactive")
482
483 -- | This is the package Id for the current program. It is the default
484 -- package Id if you don't specify a package name. We don't add this prefix
485 -- to symbol names, since there can be only one main package per program.
486 mainUnitId = fsToUnitId (fsLit "main")
487
488 -- | This is a fake package id used to provide identities to any un-implemented
489 -- signatures. The set of hole identities is global over an entire compilation.
490 holeUnitId :: UnitId
491 holeUnitId = fsToUnitId (fsLit "hole")
492
493 isInteractiveModule :: Module -> Bool
494 isInteractiveModule mod = moduleUnitId mod == interactiveUnitId
495
496 isHoleModule :: Module -> Bool
497 isHoleModule mod = moduleUnitId mod == holeUnitId
498
499 wiredInUnitIds :: [UnitId]
500 wiredInUnitIds = [ primUnitId,
501 integerUnitId,
502 baseUnitId,
503 rtsUnitId,
504 thUnitId,
505 thisGhcUnitId,
506 dphSeqUnitId,
507 dphParUnitId ]
508
509 {-
510 ************************************************************************
511 * *
512 \subsection{@ModuleEnv@s}
513 * *
514 ************************************************************************
515 -}
516
517 -- | A map keyed off of 'Module's
518 newtype ModuleEnv elt = ModuleEnv (Map Module elt)
519
520 filterModuleEnv :: (Module -> a -> Bool) -> ModuleEnv a -> ModuleEnv a
521 filterModuleEnv f (ModuleEnv e) = ModuleEnv (Map.filterWithKey f e)
522
523 elemModuleEnv :: Module -> ModuleEnv a -> Bool
524 elemModuleEnv m (ModuleEnv e) = Map.member m e
525
526 extendModuleEnv :: ModuleEnv a -> Module -> a -> ModuleEnv a
527 extendModuleEnv (ModuleEnv e) m x = ModuleEnv (Map.insert m x e)
528
529 extendModuleEnvWith :: (a -> a -> a) -> ModuleEnv a -> Module -> a -> ModuleEnv a
530 extendModuleEnvWith f (ModuleEnv e) m x = ModuleEnv (Map.insertWith f m x e)
531
532 extendModuleEnvList :: ModuleEnv a -> [(Module, a)] -> ModuleEnv a
533 extendModuleEnvList (ModuleEnv e) xs = ModuleEnv (Map.insertList xs e)
534
535 extendModuleEnvList_C :: (a -> a -> a) -> ModuleEnv a -> [(Module, a)]
536 -> ModuleEnv a
537 extendModuleEnvList_C f (ModuleEnv e) xs = ModuleEnv (Map.insertListWith f xs e)
538
539 plusModuleEnv_C :: (a -> a -> a) -> ModuleEnv a -> ModuleEnv a -> ModuleEnv a
540 plusModuleEnv_C f (ModuleEnv e1) (ModuleEnv e2) = ModuleEnv (Map.unionWith f e1 e2)
541
542 delModuleEnvList :: ModuleEnv a -> [Module] -> ModuleEnv a
543 delModuleEnvList (ModuleEnv e) ms = ModuleEnv (Map.deleteList ms e)
544
545 delModuleEnv :: ModuleEnv a -> Module -> ModuleEnv a
546 delModuleEnv (ModuleEnv e) m = ModuleEnv (Map.delete m e)
547
548 plusModuleEnv :: ModuleEnv a -> ModuleEnv a -> ModuleEnv a
549 plusModuleEnv (ModuleEnv e1) (ModuleEnv e2) = ModuleEnv (Map.union e1 e2)
550
551 lookupModuleEnv :: ModuleEnv a -> Module -> Maybe a
552 lookupModuleEnv (ModuleEnv e) m = Map.lookup m e
553
554 lookupWithDefaultModuleEnv :: ModuleEnv a -> a -> Module -> a
555 lookupWithDefaultModuleEnv (ModuleEnv e) x m = Map.findWithDefault x m e
556
557 mapModuleEnv :: (a -> b) -> ModuleEnv a -> ModuleEnv b
558 mapModuleEnv f (ModuleEnv e) = ModuleEnv (Map.mapWithKey (\_ v -> f v) e)
559
560 mkModuleEnv :: [(Module, a)] -> ModuleEnv a
561 mkModuleEnv xs = ModuleEnv (Map.fromList xs)
562
563 emptyModuleEnv :: ModuleEnv a
564 emptyModuleEnv = ModuleEnv Map.empty
565
566 moduleEnvKeys :: ModuleEnv a -> [Module]
567 moduleEnvKeys (ModuleEnv e) = Map.keys e
568
569 moduleEnvElts :: ModuleEnv a -> [a]
570 moduleEnvElts (ModuleEnv e) = Map.elems e
571
572 moduleEnvToList :: ModuleEnv a -> [(Module, a)]
573 moduleEnvToList (ModuleEnv e) = Map.toList e
574
575 unitModuleEnv :: Module -> a -> ModuleEnv a
576 unitModuleEnv m x = ModuleEnv (Map.singleton m x)
577
578 isEmptyModuleEnv :: ModuleEnv a -> Bool
579 isEmptyModuleEnv (ModuleEnv e) = Map.null e
580
581 -- | A set of 'Module's
582 type ModuleSet = Set Module
583
584 mkModuleSet :: [Module] -> ModuleSet
585 extendModuleSet :: ModuleSet -> Module -> ModuleSet
586 emptyModuleSet :: ModuleSet
587 moduleSetElts :: ModuleSet -> [Module]
588 elemModuleSet :: Module -> ModuleSet -> Bool
589
590 emptyModuleSet = Set.empty
591 mkModuleSet = Set.fromList
592 extendModuleSet s m = Set.insert m s
593 moduleSetElts = Set.toList
594 elemModuleSet = Set.member
595
596 {-
597 A ModuleName has a Unique, so we can build mappings of these using
598 UniqFM.
599 -}
600
601 -- | A map keyed off of 'ModuleName's (actually, their 'Unique's)
602 type ModuleNameEnv elt = UniqFM elt
603
604
605 -- | A map keyed off of 'ModuleName's (actually, their 'Unique's)
606 -- Has deterministic folds and can be deterministically converted to a list
607 type DModuleNameEnv elt = UniqDFM elt