summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2015-06-23 13:31:15 -0700
committerEdward Z. Yang <ezyang@cs.stanford.edu>2015-07-07 19:50:56 -0700
commitd71b65f53a1daa2631d2c818c7ea6add77813532 (patch)
tree7309c11dee1c3ed536612317c5df7c6904f74bfe
parent8800a73a03c70357c81f24ef53f4644de6668d9d (diff)
downloadhaskell-d71b65f53a1daa2631d2c818c7ea6add77813532.tar.gz
holePackageKey and isHoleModule utility functions.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
-rw-r--r--compiler/basicTypes/Module.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/basicTypes/Module.hs b/compiler/basicTypes/Module.hs
index a20de2d0b3..2c60463c04 100644
--- a/compiler/basicTypes/Module.hs
+++ b/compiler/basicTypes/Module.hs
@@ -42,6 +42,7 @@ module Module
dphParPackageKey,
mainPackageKey,
thisGhcPackageKey,
+ holePackageKey, isHoleModule,
interactivePackageKey, isInteractiveModule,
wiredInPackageKeys,
@@ -399,9 +400,17 @@ interactivePackageKey = fsToPackageKey (fsLit "interactive")
-- to symbol names, since there can be only one main package per program.
mainPackageKey = fsToPackageKey (fsLit "main")
+-- | This is a fake package id used to provide identities to any un-implemented
+-- signatures. The set of hole identities is global over an entire compilation.
+holePackageKey :: PackageKey
+holePackageKey = fsToPackageKey (fsLit "hole")
+
isInteractiveModule :: Module -> Bool
isInteractiveModule mod = modulePackageKey mod == interactivePackageKey
+isHoleModule :: Module -> Bool
+isHoleModule mod = modulePackageKey mod == holePackageKey
+
wiredInPackageKeys :: [PackageKey]
wiredInPackageKeys = [ primPackageKey,
integerPackageKey,