[commit: ghc] master: holePackageKey and isHoleModule utility functions. (d71b65f)

git at git.haskell.org git at git.haskell.org
Wed Jul 8 05:11:45 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/d71b65f53a1daa2631d2c818c7ea6add77813532/ghc

>---------------------------------------------------------------

commit d71b65f53a1daa2631d2c818c7ea6add77813532
Author: Edward Z. Yang <ezyang at cs.stanford.edu>
Date:   Tue Jun 23 13:31:15 2015 -0700

    holePackageKey and isHoleModule utility functions.
    
    Signed-off-by: Edward Z. Yang <ezyang at cs.stanford.edu>


>---------------------------------------------------------------

d71b65f53a1daa2631d2c818c7ea6add77813532
 compiler/basicTypes/Module.hs | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/compiler/basicTypes/Module.hs b/compiler/basicTypes/Module.hs
index a20de2d..2c60463 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,



More information about the ghc-commits mailing list