[commit: ghc] master: Move newImplicitBinder to from IfaceEnv to BuildTyCl (211b349)

git at git.haskell.org git at git.haskell.org
Thu Aug 27 07:13:41 UTC 2015


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

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

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

commit 211b3497f19510f94c00d4c234f59da48695b563
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Thu Aug 27 08:01:21 2015 +0200

    Move newImplicitBinder to from IfaceEnv to BuildTyCl


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

211b3497f19510f94c00d4c234f59da48695b563
 compiler/iface/BuildTyCl.hs | 18 ++++++++++++++++++
 compiler/iface/IfaceEnv.hs  | 20 +-------------------
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/compiler/iface/BuildTyCl.hs b/compiler/iface/BuildTyCl.hs
index 0a922e8..640ad9b 100644
--- a/compiler/iface/BuildTyCl.hs
+++ b/compiler/iface/BuildTyCl.hs
@@ -341,3 +341,21 @@ Here we can't use a newtype either, even though there is only
 one field, because equality predicates are unboxed, and classes
 are boxed.
 -}
+
+newImplicitBinder :: Name                       -- Base name
+                  -> (OccName -> OccName)       -- Occurrence name modifier
+                  -> TcRnIf m n Name            -- Implicit name
+-- Called in BuildTyCl to allocate the implicit binders of type/class decls
+-- For source type/class decls, this is the first occurrence
+-- For iface ones, the LoadIface has alrady allocated a suitable name in the cache
+newImplicitBinder base_name mk_sys_occ
+  | Just mod <- nameModule_maybe base_name
+  = newGlobalBinder mod occ loc
+  | otherwise           -- When typechecking a [d| decl bracket |],
+                        -- TH generates types, classes etc with Internal names,
+                        -- so we follow suit for the implicit binders
+  = do  { uniq <- newUnique
+        ; return (mkInternalName uniq occ loc) }
+  where
+    occ = mk_sys_occ (nameOccName base_name)
+    loc = nameSrcSpan base_name
diff --git a/compiler/iface/IfaceEnv.hs b/compiler/iface/IfaceEnv.hs
index a822b10..2981550 100644
--- a/compiler/iface/IfaceEnv.hs
+++ b/compiler/iface/IfaceEnv.hs
@@ -3,7 +3,7 @@
 {-# LANGUAGE CPP, RankNTypes #-}
 
 module IfaceEnv (
-        newGlobalBinder, newImplicitBinder, newInteractiveBinder,
+        newGlobalBinder, newInteractiveBinder,
         externaliseName,
         lookupIfaceTop,
         lookupOrig, lookupOrigNameCache, extendNameCache,
@@ -130,24 +130,6 @@ allocateGlobalBinder name_supply mod occ loc
                     new_cache       = extendNameCache (nsNames name_supply) mod occ name
                     new_name_supply = name_supply {nsUniqs = us', nsNames = new_cache}
 
-newImplicitBinder :: Name                       -- Base name
-                  -> (OccName -> OccName)       -- Occurrence name modifier
-                  -> TcRnIf m n Name            -- Implicit name
--- Called in BuildTyCl to allocate the implicit binders of type/class decls
--- For source type/class decls, this is the first occurrence
--- For iface ones, the LoadIface has alrady allocated a suitable name in the cache
-newImplicitBinder base_name mk_sys_occ
-  | Just mod <- nameModule_maybe base_name
-  = newGlobalBinder mod occ loc
-  | otherwise           -- When typechecking a [d| decl bracket |],
-                        -- TH generates types, classes etc with Internal names,
-                        -- so we follow suit for the implicit binders
-  = do  { uniq <- newUnique
-        ; return (mkInternalName uniq occ loc) }
-  where
-    occ = mk_sys_occ (nameOccName base_name)
-    loc = nameSrcSpan base_name
-
 ifaceExportNames :: [IfaceExport] -> TcRnIf gbl lcl [AvailInfo]
 ifaceExportNames exports = return exports
 



More information about the ghc-commits mailing list