-{-% DrIFT (Automatic class derivations for Haskell) v1.1 %-}
%
+% (c) The University of Glasgow 2006
% (c) The GRASP/AQUA Project, Glasgow University, 1992-1998
%
-\section[OccName]{@OccName@}
-
\begin{code}
module OccName (
-- * The NameSpace type; abstact
#include "HsVersions.h"
-import Util ( thenCmp )
-import Unique ( Unique, mkUnique, Uniquable(..) )
-import BasicTypes ( Boxity(..), Arity )
-import StaticFlags ( opt_PprStyle_Debug )
+import Util
+import Unique
+import BasicTypes
+import StaticFlags
import UniqFM
import UniqSet
import FastString
import Outputable
import Binary
-import GLAEXTS
-
-import Data.Char ( isUpper, isLower, ord )
+import GHC.Exts
+import Data.Char
-- Unicode TODO: put isSymbol in libcompat
#if __GLASGOW_HASKELL__ > 604
mkIPOcc = mk_simple_deriv varName "$i"
mkSpecOcc = mk_simple_deriv varName "$s"
mkForeignExportOcc = mk_simple_deriv varName "$f"
-mkNewTyCoOcc = mk_simple_deriv tcName "Co"
+mkNewTyCoOcc = mk_simple_deriv tcName ":Co"
+mkInstTyCoOcc = mk_simple_deriv tcName ":Co" -- derived from rep ty
-- Generic derivable classes
mkGenOcc1 = mk_simple_deriv varName "$gfrom"
-- that need encoding (e.g. 'z'!)
\end{code}
-\begin{code}
+Derive a name for the representation type constructor of a data/newtype
+instance.
--- Derive a name for the representation type constructor of a data/newtype
--- instance.
---
-mkInstTyTcOcc :: Unique -- Unique
- -> OccName -- Local name (e.g. "Map")
+\begin{code}
+mkInstTyTcOcc :: Int -- Index
+ -> OccName -- Family name (e.g. "Map")
-> OccName -- Nice unique version (":R23Map")
-mkInstTyTcOcc uniq occ
- = mk_deriv varName (":R" ++ show uniq) (occNameString occ)
-
--- Derive a name for the coercion of a data/newtype instance.
---
-mkInstTyCoOcc :: Unique -- Unique
- -> OccName -- Local name (e.g. "Map")
- -> OccName -- Nice unique version ("Co23Map")
-mkInstTyCoOcc uniq occ
- = mk_deriv varName ("Co" ++ show uniq) (occNameString occ)
-
+mkInstTyTcOcc index occ
+ = mk_deriv tcName (":R" ++ show index) (occNameString occ)
\end{code}
\begin{code}