summaryrefslogtreecommitdiff
path: root/compiler/GHC/Types/Name/Occurrence.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Types/Name/Occurrence.hs')
-rw-r--r--compiler/GHC/Types/Name/Occurrence.hs21
1 files changed, 21 insertions, 0 deletions
diff --git a/compiler/GHC/Types/Name/Occurrence.hs b/compiler/GHC/Types/Name/Occurrence.hs
index 964c313abd..316b3e911f 100644
--- a/compiler/GHC/Types/Name/Occurrence.hs
+++ b/compiler/GHC/Types/Name/Occurrence.hs
@@ -104,6 +104,9 @@ module GHC.Types.Name.Occurrence (
unionOccSets, unionManyOccSets, elemOccSet,
isEmptyOccSet,
+ -- * Dealing with main
+ mainOcc, ppMainFn,
+
-- * Tidying up
TidyOccEnv, emptyTidyOccEnv, initTidyOccEnv,
tidyOccName, avoidClashesOccEnv, delTidyOccEnvList,
@@ -1253,6 +1256,24 @@ tidyOccName env occ@(OccName occ_sp fs)
{-
************************************************************************
* *
+ Utilies for "main"
+* *
+************************************************************************
+-}
+
+mainOcc :: OccName
+mainOcc = mkVarOccFS (fsLit "main")
+
+ppMainFn :: OccName -> SDoc
+ppMainFn main_occ
+ | main_occ == mainOcc
+ = text "IO action" <+> quotes (ppr main_occ)
+ | otherwise
+ = text "main IO action" <+> quotes (ppr main_occ)
+
+{-
+************************************************************************
+* *
Binary instance
Here rather than in GHC.Iface.Binary because OccName is abstract
* *