Commit dad39ff0 authored by Ryan Scott's avatar Ryan Scott
Browse files

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).
parent 3eac3a0e
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment