Commit 51a571c0 authored by simonpj's avatar simonpj

[project @ 2001-03-08 12:07:38 by simonpj]

--------------------
	A major hygiene pass
	--------------------

1. The main change here is to

	Move what was the "IdFlavour" out of IdInfo,
	and into the varDetails field of a Var

   It was a mess before, because the flavour was a permanent attribute
   of an Id, whereas the rest of the IdInfo was ephemeral.  It's
   all much tidier now.

   Main places to look:

	   Var.lhs	Defn of VarDetails
	   IdInfo.lhs	Defn of GlobalIdDetails

   The main remaining infelicity is that SpecPragmaIds are right down
   in Var.lhs, which seems unduly built-in for such an ephemeral thing.
   But that is no worse than before.


2. Tidy up the HscMain story a little.  Move mkModDetails from MkIface
   into CoreTidy (where it belongs more nicely)

   This was partly forced by (1) above, because I didn't want to make
   DictFun Ids into a separate kind of Id (which is how it was before).
   Not having them separate means we have to keep a list of them right
   through, rather than pull them out of the bindings at the end.

3. Add NameEnv as a separate module (to join NameSet).

4. Remove unnecessary {-# SOURCE #-} imports from FieldLabel.
parent d78151f6
......@@ -5,12 +5,12 @@ The Name/Var/Type group is a bit complicated. Here's the deal
Things in brackets are what the module *uses*.
A 'loop' indicates a use from a module compiled later
Name, PrimRep, FieldLabel (loop Type.Type)
Name, PrimRep
then
PrelNames
then
Var (Name, loop CoreSyn.CoreExpr, loop IdInfo.IdInfo,
loop Type.GenType, loop Type.Kind)
Var (Name, loop IdInfo.IdInfo,
loop Type.Type, loop Type.Kind)
then
VarEnv, VarSet, ThinAir
then
......@@ -20,7 +20,7 @@ then
then
Type (loop DataCon.DataCon, loop Subst.substTy)
then
TysPrim (Type), PprEnv (loop DataCon.DataCon, Type)
FieldLabel( Type), TysPrim (Type), PprEnv (loop DataCon.DataCon, Type)
then
Unify, PprType (PprEnv)
then
......
......@@ -16,9 +16,8 @@ module FieldLabel(
#include "HsVersions.h"
import {-# SOURCE #-} TypeRep( Type ) -- FieldLabel is compiled very early
import {-# SOURCE #-} TyCon( TyCon ) -- FieldLabel is compiled very early
import Type( Type )
import TyCon( TyCon )
import Name ( Name{-instance Eq/Outputable-}, NamedThing(..), nameUnique )
import Outputable
import Unique ( Uniquable(..) )
......
......@@ -8,28 +8,29 @@ module Id (
Id, DictId,
-- Simple construction
mkId, mkVanillaId, mkSysLocal, mkUserLocal,
mkGlobalId, mkLocalId, mkSpecPragmaId, mkLocalIdWithInfo,
mkSysLocal, mkUserLocal, mkVanillaGlobal,
mkTemplateLocals, mkTemplateLocalsNum, mkWildId, mkTemplateLocal,
mkWorkerId,
-- Taking an Id apart
idName, idType, idUnique, idInfo,
idPrimRep, isId,
idPrimRep, isId, globalIdDetails,
recordSelectorFieldLabel,
-- Modifying an Id
setIdName, setIdUnique, setIdType, setIdNoDiscard,
setIdName, setIdUnique, setIdType, setIdNoDiscard, setGlobalIdDetails,
setIdInfo, lazySetIdInfo, modifyIdInfo, maybeModifyIdInfo,
zapLamIdInfo, zapDemandIdInfo,
zapLamIdInfo, zapDemandIdInfo,
-- Predicates
isImplicitId, isDeadBinder,
externallyVisibleId,
isSpecPragmaId, isRecordSelector,
isPrimOpId, isPrimOpId_maybe, isDictFunId,
isSpecPragmaId, isExportedId, isLocalId, isGlobalId,
isRecordSelector,
isPrimOpId, isPrimOpId_maybe,
isDataConId, isDataConId_maybe,
isDataConWrapId, isDataConWrapId_maybe,
isBottomingId,
isExportedId, isLocalId,
hasNoBinding,
-- Inline pragma stuff
......@@ -52,7 +53,6 @@ module Id (
setIdOccInfo,
idArity, idArityInfo,
idFlavour,
idDemandInfo,
idStrictness,
idTyGenInfo,
......@@ -72,13 +72,14 @@ module Id (
import CoreSyn ( Unfolding, CoreRules )
import BasicTypes ( Arity )
import Var ( Id, DictId,
isId, mkIdVar,
idName, idType, idUnique, idInfo,
setIdName, setVarType, setIdUnique,
isId, isExportedId, isSpecPragmaId, isLocalId,
idName, idType, idUnique, idInfo, isGlobalId,
setIdName, setVarType, setIdUnique, setIdNoDiscard,
setIdInfo, lazySetIdInfo, modifyIdInfo,
maybeModifyIdInfo,
externallyVisibleId
globalIdDetails, setGlobalIdDetails
)
import qualified Var ( mkLocalId, mkGlobalId, mkSpecPragmaId )
import Type ( Type, typePrimRep, addFreeTyVars,
usOnce, seqType, splitTyConApp_maybe )
......@@ -87,9 +88,9 @@ import IdInfo
import Demand ( Demand )
import Name ( Name, OccName,
mkSysLocalName, mkLocalName,
getOccName
getOccName, getSrcLoc
)
import OccName ( UserFS )
import OccName ( UserFS, mkWorkerOcc )
import PrimRep ( PrimRep )
import TysPrim ( statePrimTyCon )
import FieldLabel ( FieldLabel )
......@@ -120,38 +121,54 @@ infixl 1 `setIdUnfolding`,
%* *
%************************************************************************
Absolutely all Ids are made by mkId. It
a) Pins free-tyvar-info onto the Id's type,
where it can easily be found.
b) Ensures that exported Ids are
Absolutely all Ids are made by mkId. It is just like Var.mkId,
but in addition it pins free-tyvar-info onto the Id's type,
where it can easily be found.
\begin{code}
mkId :: Name -> Type -> IdInfo -> Id
mkId name ty info = mkIdVar name (addFreeTyVars ty) info
mkLocalIdWithInfo :: Name -> Type -> IdInfo -> Id
mkLocalIdWithInfo name ty info = Var.mkLocalId name (addFreeTyVars ty) info
mkSpecPragmaId :: OccName -> Unique -> Type -> SrcLoc -> Id
mkSpecPragmaId occ uniq ty loc = Var.mkSpecPragmaId (mkLocalName uniq occ loc)
(addFreeTyVars ty)
noCafIdInfo
mkGlobalId :: GlobalIdDetails -> Name -> Type -> IdInfo -> Id
mkGlobalId details name ty info = Var.mkGlobalId details name (addFreeTyVars ty) info
\end{code}
\begin{code}
mkVanillaId :: Name -> Type -> Id
mkVanillaId name ty = mkId name ty vanillaIdInfo
mkLocalId :: Name -> Type -> Id
mkLocalId name ty = mkLocalIdWithInfo name ty noCafIdInfo
-- SysLocal: for an Id being created by the compiler out of thin air...
-- UserLocal: an Id with a name the user might recognize...
mkUserLocal :: OccName -> Unique -> Type -> SrcLoc -> Id
mkSysLocal :: UserFS -> Unique -> Type -> Id
mkVanillaGlobal :: Name -> Type -> IdInfo -> Id
mkSysLocal fs uniq ty = mkVanillaId (mkSysLocalName uniq fs) ty
mkUserLocal occ uniq ty loc = mkVanillaId (mkLocalName uniq occ loc) ty
mkSysLocal fs uniq ty = mkLocalId (mkSysLocalName uniq fs) ty
mkUserLocal occ uniq ty loc = mkLocalId (mkLocalName uniq occ loc) ty
mkVanillaGlobal = mkGlobalId VanillaGlobal
\end{code}
Make some local @Ids@ for a template @CoreExpr@. These have bogus
@Uniques@, but that's OK because the templates are supposed to be
instantiated before use.
\begin{code}
-- "Wild Id" typically used when you need a binder that you don't expect to use
mkWildId :: Type -> Id
mkWildId ty = mkSysLocal SLIT("wild") (mkBuiltinUnique 1) ty
mkWorkerId :: Unique -> Id -> Type -> Id
-- A worker gets a local name. CoreTidy will globalise it if necessary.
mkWorkerId uniq unwrkr ty
= mkLocalId wkr_name ty
where
wkr_name = mkLocalName uniq (mkWorkerOcc (getOccName unwrkr)) (getSrcLoc unwrkr)
-- "Template locals" typically used in unfoldings
mkTemplateLocals :: [Type] -> [Id]
mkTemplateLocals tys = zipWith (mkSysLocal SLIT("tpl"))
......@@ -161,8 +178,8 @@ mkTemplateLocals tys = zipWith (mkSysLocal SLIT("tpl"))
mkTemplateLocalsNum :: Int -> [Type] -> [Id]
-- The Int gives the starting point for unique allocation
mkTemplateLocalsNum n tys = zipWith (mkSysLocal SLIT("tpl"))
(getNumBuiltinUniques n (length tys))
tys
(getNumBuiltinUniques n (length tys))
tys
mkTemplateLocal :: Int -> Type -> Id
mkTemplateLocal i ty = mkSysLocal SLIT("tpl") (mkBuiltinUnique i) ty
......@@ -191,95 +208,64 @@ idPrimRep id = typePrimRep (idType id)
%* *
%************************************************************************
\begin{code}
idFlavour :: Id -> IdFlavour
idFlavour id = flavourInfo (idInfo id)
The @SpecPragmaId@ exists only to make Ids that are
on the *LHS* of bindings created by SPECIALISE pragmas;
eg: s = f Int d
The SpecPragmaId is never itself mentioned; it
exists solely so that the specialiser will find
the call to f, and make specialised version of it.
The SpecPragmaId binding is discarded by the specialiser
when it gathers up overloaded calls.
Meanwhile, it is not discarded as dead code.
setIdNoDiscard :: Id -> Id
setIdNoDiscard id -- Make an Id into a NoDiscardId, unless it is already
= modifyIdInfo setNoDiscardInfo id
\begin{code}
recordSelectorFieldLabel :: Id -> FieldLabel
recordSelectorFieldLabel id = case idFlavour id of
RecordSelId lbl -> lbl
recordSelectorFieldLabel id = case globalIdDetails id of
RecordSelId lbl -> lbl
isRecordSelector id = case idFlavour id of
isRecordSelector id = case globalIdDetails id of
RecordSelId lbl -> True
other -> False
isPrimOpId id = case idFlavour id of
isPrimOpId id = case globalIdDetails id of
PrimOpId op -> True
other -> False
isPrimOpId_maybe id = case idFlavour id of
isPrimOpId_maybe id = case globalIdDetails id of
PrimOpId op -> Just op
other -> Nothing
isDataConId id = case idFlavour id of
isDataConId id = case globalIdDetails id of
DataConId _ -> True
other -> False
isDataConId_maybe id = case idFlavour id of
isDataConId_maybe id = case globalIdDetails id of
DataConId con -> Just con
other -> Nothing
isDataConWrapId_maybe id = case idFlavour id of
isDataConWrapId_maybe id = case globalIdDetails id of
DataConWrapId con -> Just con
other -> Nothing
isDataConWrapId id = case idFlavour id of
isDataConWrapId id = case globalIdDetails id of
DataConWrapId con -> True
other -> False
isSpecPragmaId id = case idFlavour id of
SpecPragmaId -> True
other -> False
hasNoBinding id = case idFlavour id of
DataConId _ -> True
PrimOpId _ -> True
other -> False
-- hasNoBinding returns True of an Id which may not have a
-- binding, even though it is defined in this module. Notably,
-- the constructors of a dictionary are in this situation.
hasNoBinding id = case globalIdDetails id of
DataConId _ -> True
PrimOpId _ -> True
other -> False
isDictFunId id = case idFlavour id of
DictFunId -> True
other -> False
-- Don't drop a binding for an exported Id,
-- if it otherwise looks dead.
-- Perhaps a better name would be isDiscardableId
isExportedId :: Id -> Bool
isExportedId id = case idFlavour id of
VanillaId -> False
other -> True
isLocalId :: Id -> Bool
-- True of Ids that are locally defined, but are not constants
-- like data constructors, record selectors, and the like.
-- See comments with CoreFVs.isLocalVar
isLocalId id
#ifdef DEBUG
| not (isId id) = pprTrace "isLocalid" (ppr id) False
| otherwise
#endif
= case idFlavour id of
VanillaId -> True
ExportedId -> True
SpecPragmaId -> True
other -> False
\end{code}
isImplicitId tells whether an Id's info is implied by other
declarations, so we don't need to put its signature in an interface
file, even if it's mentioned in some other interface unfolding.
\begin{code}
isImplicitId :: Id -> Bool
-- isImplicitId tells whether an Id's info is implied by other
-- declarations, so we don't need to put its signature in an interface
-- file, even if it's mentioned in some other interface unfolding.
isImplicitId id
= case idFlavour id of
= case globalIdDetails id of
RecordSelId _ -> True -- Includes dictionary selectors
PrimOpId _ -> True
DataConId _ -> True
......
_interface_ IdInfo 1
_exports_
IdInfo IdInfo seqIdInfo vanillaIdInfo;
IdInfo IdInfo GlobalIdDetails notGlobalId seqIdInfo vanillaIdInfo;
_declarations_
1 data IdInfo ;
1 data GlobalIdDetails ;
1 notGlobalId _:_ GlobalIdDetails ;;
1 seqIdInfo _:_ IdInfo -> PrelBase.() ;;
1 vanillaIdInfo _:_ IdInfo ;;
__interface IdInfo 1 0 where
__export IdInfo IdInfo seqIdInfo vanillaIdInfo ;
__export IdInfo IdInfo GlobalIdDetails notGlobalId seqIdInfo vanillaIdInfo ;
1 data IdInfo ;
1 data GlobalIdDetails ;
1 notGlobalId :: GlobalIdDetails ;
1 seqIdInfo :: IdInfo -> PrelBase.Z0T ;
1 vanillaIdInfo :: IdInfo ;
......@@ -8,18 +8,15 @@ Haskell. [WDP 94/11])
\begin{code}
module IdInfo (
IdInfo, -- Abstract
GlobalIdDetails(..), notGlobalId, -- Not abstract
vanillaIdInfo, constantIdInfo, mkIdInfo, seqIdInfo, megaSeqIdInfo,
IdInfo, -- Abstract
vanillaIdInfo, noTyGenIdInfo, noCafOrTyGenIdInfo, noCafIdInfo,
seqIdInfo, megaSeqIdInfo,
-- Zapping
zapLamInfo, zapDemandInfo,
zapSpecPragInfo, shortableIdInfo, copyIdInfo,
-- Flavour
IdFlavour(..), flavourInfo, makeConstantFlavour,
setNoDiscardInfo, setFlavourInfo,
ppFlavourInfo,
shortableIdInfo, copyIdInfo,
-- Arity
ArityInfo(..),
......@@ -104,14 +101,54 @@ infixl 1 `setDemandInfo`,
-- infixl so you can say (id `set` a `set` b)
\end{code}
%************************************************************************
%* *
\subsection{GlobalIdDetails
%* *
%************************************************************************
This type is here (rather than in Id.lhs) mainly because there's
an IdInfo.hi-boot, but no Id.hi-boot, and GlobalIdDetails is imported
(recursively) by Var.lhs.
\begin{code}
data GlobalIdDetails
= VanillaGlobal -- Imported from elsewhere, a default method Id.
| RecordSelId FieldLabel -- The Id for a record selector
| DataConId DataCon -- The Id for a data constructor *worker*
| DataConWrapId DataCon -- The Id for a data constructor *wrapper*
-- [the only reasons we need to know is so that
-- a) we can suppress printing a definition in the interface file
-- b) when typechecking a pattern we can get from the
-- Id back to the data con]
| PrimOpId PrimOp -- The Id for a primitive operator
| NotGlobalId -- Used as a convenient extra return value from globalIdDetails
notGlobalId = NotGlobalId
instance Outputable GlobalIdDetails where
ppr NotGlobalId = ptext SLIT("[***NotGlobalId***]")
ppr VanillaGlobal = ptext SLIT("[GlobalId]")
ppr (DataConId _) = ptext SLIT("[DataCon]")
ppr (DataConWrapId _) = ptext SLIT("[DataConWrapper]")
ppr (PrimOpId _) = ptext SLIT("[PrimOp]")
ppr (RecordSelId _) = ptext SLIT("[RecSel]")
\end{code}
%************************************************************************
%* *
\subsection{The main IdInfo type}
%* *
%************************************************************************
An @IdInfo@ gives {\em optional} information about an @Id@. If
present it never lies, but it may not be present, in which case there
is always a conservative assumption which can be made.
There is one exception: the 'flavour' is *not* optional.
You must not discard it.
It used to be in Var.lhs, but that seems unclean.
Two @Id@s may have different info even though they have the same
@Unique@ (and are hence the same @Id@); for example, one might lack
the properties attached to the other.
......@@ -124,7 +161,6 @@ case. KSW 1999-04).
\begin{code}
data IdInfo
= IdInfo {
flavourInfo :: IdFlavour, -- NOT OPTIONAL
arityInfo :: ArityInfo, -- Its arity
demandInfo :: Demand, -- Whether or not it is definitely demanded
specInfo :: CoreRules, -- Specialisations of this function which exist
......@@ -144,8 +180,7 @@ seqIdInfo (IdInfo {}) = ()
megaSeqIdInfo :: IdInfo -> ()
megaSeqIdInfo info
= seqFlavour (flavourInfo info) `seq`
seqArity (arityInfo info) `seq`
= seqArity (arityInfo info) `seq`
seqDemand (demandInfo info) `seq`
seqRules (specInfo info) `seq`
seqTyGenInfo (tyGenInfo info) `seq`
......@@ -165,7 +200,6 @@ megaSeqIdInfo info
Setters
\begin{code}
setFlavourInfo info fl = fl `seq` info { flavourInfo = fl }
setWorkerInfo info wk = wk `seq` info { workerInfo = wk }
setSpecInfo info sp = PSEQ sp (info { specInfo = sp })
setTyGenInfo info tg = tg `seq` info { tyGenInfo = tg }
......@@ -197,34 +231,14 @@ setArityInfo info ar = info { arityInfo = ar }
setCafInfo info cf = info { cafInfo = cf }
setCprInfo info cp = info { cprInfo = cp }
setLBVarInfo info lb = info { lbvarInfo = lb }
setNoDiscardInfo info = case flavourInfo info of
VanillaId -> info { flavourInfo = ExportedId }
other -> info
zapSpecPragInfo info = case flavourInfo info of
SpecPragmaId -> info { flavourInfo = VanillaId }
other -> info
\end{code}
\begin{code}
vanillaIdInfo :: IdInfo
-- Used for locally-defined Ids
-- We are going to calculate correct CAF information at the end
vanillaIdInfo = mkIdInfo VanillaId NoCafRefs
constantIdInfo :: IdInfo
-- Used for imported Ids
-- The default is that they *do* have CAFs; an interface-file pragma
-- may say "oh no it doesn't", but in the absence of such a pragma
-- we'd better assume it does
constantIdInfo = mkIdInfo ConstantId MayHaveCafRefs
mkIdInfo :: IdFlavour -> CafInfo -> IdInfo
mkIdInfo flv caf
vanillaIdInfo
= IdInfo {
flavourInfo = flv,
cafInfo = caf,
cafInfo = MayHaveCafRefs, -- Safe!
arityInfo = UnknownArity,
demandInfo = wwLazy,
specInfo = emptyCoreRules,
......@@ -237,74 +251,18 @@ mkIdInfo flv caf
inlinePragInfo = NoInlinePragInfo,
occInfo = NoOccInfo
}
\end{code}
%************************************************************************
%* *
\subsection{Flavour}
%* *
%************************************************************************
\begin{code}
data IdFlavour
= VanillaId -- Locally defined, not exported
| ExportedId -- Locally defined, exported
| SpecPragmaId -- Locally defined, RHS holds specialised call
| ConstantId -- Imported from elsewhere, or a default method Id.
noTyGenIdInfo = vanillaIdInfo `setTyGenInfo` TyGenNever
-- Many built-in things have fixed types, so we shouldn't
-- run around generalising them
| DictFunId -- We flag dictionary functions so that we can
-- conveniently extract the DictFuns from a set of
-- bindings when building a module's interface
noCafIdInfo = vanillaIdInfo `setCafInfo` NoCafRefs
-- Local things don't refer to Cafs
| DataConId DataCon -- The Id for a data constructor *worker*
| DataConWrapId DataCon -- The Id for a data constructor *wrapper*
-- [the only reasons we need to know is so that
-- a) we can suppress printing a definition in the interface file
-- b) when typechecking a pattern we can get from the
-- Id back to the data con]
| PrimOpId PrimOp -- The Id for a primitive operator
| RecordSelId FieldLabel -- The Id for a record selector
makeConstantFlavour :: IdFlavour -> IdFlavour
makeConstantFlavour flavour = new_flavour
where new_flavour = case flavour of
VanillaId -> ConstantId
ExportedId -> ConstantId
ConstantId -> ConstantId -- e.g. Default methods
DictFunId -> DictFunId
flavour -> pprTrace "makeConstantFlavour"
(ppFlavourInfo flavour)
flavour
ppFlavourInfo :: IdFlavour -> SDoc
ppFlavourInfo VanillaId = empty
ppFlavourInfo ExportedId = ptext SLIT("[Exported]")
ppFlavourInfo SpecPragmaId = ptext SLIT("[SpecPrag]")
ppFlavourInfo ConstantId = ptext SLIT("[Constant]")
ppFlavourInfo DictFunId = ptext SLIT("[DictFun]")
ppFlavourInfo (DataConId _) = ptext SLIT("[DataCon]")
ppFlavourInfo (DataConWrapId _) = ptext SLIT("[DataConWrapper]")
ppFlavourInfo (PrimOpId _) = ptext SLIT("[PrimOp]")
ppFlavourInfo (RecordSelId _) = ptext SLIT("[RecSel]")
seqFlavour :: IdFlavour -> ()
seqFlavour f = f `seq` ()
noCafOrTyGenIdInfo = noTyGenIdInfo `setCafInfo` NoCafRefs
-- Most also guarantee not to refer to CAFs
\end{code}
The @SpecPragmaId@ exists only to make Ids that are
on the *LHS* of bindings created by SPECIALISE pragmas;
eg: s = f Int d
The SpecPragmaId is never itself mentioned; it
exists solely so that the specialiser will find
the call to f, and make specialised version of it.
The SpecPragmaId binding is discarded by the specialiser
when it gathers up overloaded calls.
Meanwhile, it is not discarded as dead code.
%************************************************************************
%* *
......@@ -501,8 +459,6 @@ seqWorker NoWorker = ()
ppWorkerInfo NoWorker = empty
ppWorkerInfo (HasWorker wk_id _) = ptext SLIT("__P") <+> ppr wk_id
noWorkerInfo = NoWorker
workerExists :: WorkerInfo -> Bool
workerExists NoWorker = False
workerExists (HasWorker _ _) = True
......
......@@ -13,8 +13,6 @@ have a standard form, namely:
\begin{code}
module MkId (
mkSpecPragmaId, mkWorkerId,
mkDictFunId, mkDefaultMethodId,
mkDictSelId,
......@@ -54,10 +52,7 @@ import TyCon ( TyCon, isNewTyCon, tyConTyVars, tyConDataCons,
import Class ( Class, classTyCon, classTyVars, classSelIds )
import Var ( Id, TyVar )
import VarSet ( isEmptyVarSet )
import Name ( mkWiredInName, mkLocalName,
mkWorkerOcc, mkCCallName,
Name, NamedThing(..), getSrcLoc
)
import Name ( mkWiredInName, mkCCallName, Name )
import OccName ( mkVarOcc )
import PrimOp ( PrimOp(DataToTagOp, CCallOp),
primOpSig, mkPrimOpIdName,
......@@ -72,15 +67,15 @@ import DataCon ( DataCon, StrictnessMark(..),
dataConSig, dataConStrictMarks, dataConId,
maybeMarkedUnboxed, splitProductType_maybe
)
import Id ( idType, mkId,
mkVanillaId, mkTemplateLocals, mkTemplateLocalsNum,
import Id ( idType, mkGlobalId, mkVanillaGlobal,
mkTemplateLocals, mkTemplateLocalsNum,
mkTemplateLocal, idCprInfo
)
import IdInfo ( IdInfo, constantIdInfo, mkIdInfo,
import IdInfo ( IdInfo, vanillaIdInfo, noTyGenIdInfo, noCafOrTyGenIdInfo,
exactArity, setUnfoldingInfo, setCafInfo, setCprInfo,
setArityInfo, setSpecInfo, setTyGenInfo,
setArityInfo, setSpecInfo,
mkStrictnessInfo, setStrictnessInfo,
IdFlavour(..), CafInfo(..), CprInfo(..), TyGenInfo(..)
GlobalIdDetails(..), CafInfo(..), CprInfo(..)
)
import FieldLabel ( mkFieldLabel, fieldLabelName,
firstFieldLabelTag, allFieldLabelTags, fieldLabelType
......@@ -95,7 +90,6 @@ import UnicodeUtil ( stringToUtf8 )
import Char ( ord )
\end{code}
%************************************************************************
%* *
\subsection{Wired in Ids}
......@@ -130,32 +124,6 @@ wiredInIds
]
\end{code}
%************************************************************************
%* *
\subsection{Easy ones}
%* *
%************************************************************************
\begin{code}
mkSpecPragmaId occ uniq ty loc
= mkId (mkLocalName uniq occ loc) ty (mkIdInfo SpecPragmaId NoCafRefs)
-- Maybe a SysLocal? But then we'd lose the location
mkDefaultMethodId dm_name rec_c ty
= mkId dm_name ty info
where
info = constantIdInfo `setTyGenInfo` TyGenNever
-- type is wired-in (see comment at TcClassDcl.tcClassSig), so
-- do not generalise it
mkWorkerId :: Unique -> Id -> Type -> Id
-- A worker gets a local name. CoreTidy will globalise it if necessary.
mkWorkerId uniq unwrkr ty
= mkVanillaId wkr_name ty
where
wkr_name = mkLocalName uniq (mkWorkerOcc (getOccName unwrkr)) (getSrcLoc unwrkr)
\end{code}
%************************************************************************
%* *
\subsection{Data constructors}
......@@ -167,9 +135,9 @@ mkDataConId :: Name -> DataCon -> Id
-- Makes the *worker* for the data constructor; that is, the function
-- that takes the reprsentation arguments and builds the constructor.
mkDataConId work_name data_con
= mkId work_name (dataConRepType data_con) info
= mkGlobalId (DataConId data_con) work_name (dataConRepType data_con) info