summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2015-07-21 16:15:32 -0700
committerEdward Z. Yang <ezyang@cs.stanford.edu>2015-07-21 16:15:32 -0700
commit1224bb55cac502fe04005345aad47a6bc5c4a297 (patch)
tree568ee0b43028bea210616ae215fbb85b4dfba045 /compiler
parenta7e0326645bde1cc0a12f81a337ce797b159987e (diff)
downloadhaskell-1224bb55cac502fe04005345aad47a6bc5c4a297.tar.gz
Add utility function isHoleName.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Diffstat (limited to 'compiler')
-rw-r--r--compiler/basicTypes/Name.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/basicTypes/Name.hs b/compiler/basicTypes/Name.hs
index 88b6e68f97..ce8619a204 100644
--- a/compiler/basicTypes/Name.hs
+++ b/compiler/basicTypes/Name.hs
@@ -60,6 +60,7 @@ module Name (
isTyVarName, isTyConName, isDataConName,
isValName, isVarName,
isWiredInName, isBuiltInSyntax,
+ isHoleName,
wiredInNameTyThing_maybe,
nameIsLocalOrFrom, nameIsHomePackageImport, nameIsFromExternalPackage,
stableNameCmp,
@@ -212,6 +213,9 @@ isExternalName _ = False
isInternalName name = not (isExternalName name)
+isHoleName :: Name -> Bool
+isHoleName = isHoleModule . nameModule
+
nameModule name = nameModule_maybe name `orElse` pprPanic "nameModule" (ppr name)
nameModule_maybe :: Name -> Maybe Module
nameModule_maybe (Name { n_sort = External mod}) = Just mod