[commit: ghc] master: Remove dead generics-related code from OccName (dad39ff)

git at git.haskell.org git at git.haskell.org
Thu Jun 2 18:59:12 UTC 2016


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

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

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

commit dad39ff04a6585ab9cf3a2572ea922e309e6385f
Author: Ryan Scott <ryan.gl.scott at gmail.com>
Date:   Thu Jun 2 15:00:22 2016 -0400

    Remove dead generics-related code from OccName
    
    Before #9766 was fixed, GHC would generate auxiliary datatypes for every
    Generic instance, and it would use functions from OccName to prefix the
    generated names. GHC no longer generates any auxiliary datatypes for
    Generic instances, but the accompanying code was never removed from
    OccName (until now).


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

dad39ff04a6585ab9cf3a2572ea922e309e6385f
 compiler/basicTypes/OccName.hs | 29 ++---------------------------
 1 file changed, 2 insertions(+), 27 deletions(-)

diff --git a/compiler/basicTypes/OccName.hs b/compiler/basicTypes/OccName.hs
index 868fff8..4410bd1 100644
--- a/compiler/basicTypes/OccName.hs
+++ b/compiler/basicTypes/OccName.hs
@@ -60,7 +60,7 @@ module OccName (
         mkCon2TagOcc, mkTag2ConOcc, mkMaxTagOcc,
         mkClassDataConOcc, mkDictOcc, mkIPOcc,
         mkSpecOcc, mkForeignExportOcc, mkRepEqOcc,
-        mkGenD, mkGenR, mkGen1R, mkGenRCo, mkGenC, mkGenS,
+        mkGenR, mkGen1R,
         mkDataTOcc, mkDataCOcc, mkDataConWorkerOcc,
         mkSuperDictSelOcc, mkSuperDictAuxOcc,
         mkLocalOcc, mkMethodOcc, mkInstTyTcOcc,
@@ -112,7 +112,6 @@ import FastStringEnv
 import Outputable
 import Lexeme
 import Binary
-import Module
 import Data.Char
 import Data.Data
 
@@ -585,7 +584,7 @@ mkDataConWrapperOcc, mkWorkerOcc,
         mkDefaultMethodOcc,
         mkClassDataConOcc, mkDictOcc,
         mkIPOcc, mkSpecOcc, mkForeignExportOcc, mkRepEqOcc,
-        mkGenR, mkGen1R, mkGenRCo,
+        mkGenR, mkGen1R,
         mkDataTOcc, mkDataCOcc, mkDataConWorkerOcc, mkNewTyCoOcc,
         mkInstTyCoOcc, mkEqPredCoOcc, mkClassOpAuxOcc,
         mkCon2TagOcc, mkTag2ConOcc, mkMaxTagOcc,
@@ -621,32 +620,8 @@ mkTyConRepOcc occ = mk_simple_deriv varName prefix occ
            | otherwise     = "$tc"
 
 -- Generic deriving mechanism
-
--- | Generate a module-unique name, to be used e.g. while generating new names
--- for Generics types. We use module unit id to avoid name clashes when
--- package imports is used.
-mkModPrefix :: Module -> String
-mkModPrefix mod = pk ++ "_" ++ mn
-  where
-    pk = unitIdString (moduleUnitId mod)
-    mn = moduleNameString (moduleName mod)
-
-mkGenD :: Module -> OccName -> OccName
-mkGenD mod = mk_simple_deriv tcName ("D1_" ++ mkModPrefix mod ++ "_")
-
-mkGenC :: Module -> OccName -> Int -> OccName
-mkGenC mod occ m   =
-  mk_deriv tcName ("C1_" ++ show m) $
-    mkModPrefix mod ++ "_" ++ occNameString occ
-
-mkGenS :: Module -> OccName -> Int -> Int -> OccName
-mkGenS mod occ m n =
-  mk_deriv tcName ("S1_" ++ show m ++ "_" ++ show n) $
-    mkModPrefix mod ++ "_" ++ occNameString occ
-
 mkGenR   = mk_simple_deriv tcName "Rep_"
 mkGen1R  = mk_simple_deriv tcName "Rep1_"
-mkGenRCo = mk_simple_deriv tcName "CoRep_"
 
 -- data T = MkT ... deriving( Data ) needs definitions for
 --      $tT   :: Data.Generics.Basics.DataType



More information about the ghc-commits mailing list