projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'ghc-generics' of http://darcs.haskell.org/ghc into ghc-generics
[ghc-hetmet.git]
/
compiler
/
basicTypes
/
Var.lhs
diff --git
a/compiler/basicTypes/Var.lhs
b/compiler/basicTypes/Var.lhs
index
a0fa921
..
13810da
100644
(file)
--- a/
compiler/basicTypes/Var.lhs
+++ b/
compiler/basicTypes/Var.lhs
@@
-17,13
+17,19
@@
--
-- * 'Id.Id': see "Id#name_types"
--
--
-- * 'Id.Id': see "Id#name_types"
--
--- * 'Var.Var' is a synonym for the 'Id.Id' type but it may additionally potentially contain type variables,
--- which have a 'TypeRep.Kind' rather than a 'TypeRep.Type' and only contain some extra details during typechecking.
+-- * 'Var.Var' is a synonym for the 'Id.Id' type but it may additionally
+-- potentially contain type variables, which have a 'TypeRep.Kind'
+-- rather than a 'TypeRep.Type' and only contain some extra
+-- details during typechecking.
+--
-- These 'Var.Var' names may either be global or local, see "Var#globalvslocal"
--
-- #globalvslocal#
-- These 'Var.Var' names may either be global or local, see "Var#globalvslocal"
--
-- #globalvslocal#
--- Global 'Id's and 'Var's are those that are imported or correspond to a data constructor, primitive operation, or record selectors.
--- Local 'Id's and 'Var's are those bound within an expression (e.g. by a lambda) or at the top level of the module being compiled.
+-- Global 'Id's and 'Var's are those that are imported or correspond
+-- to a data constructor, primitive operation, or record selectors.
+-- Local 'Id's and 'Var's are those bound within an expression
+-- (e.g. by a lambda) or at the top level of the module being compiled.
+
module Var (
-- * The main data type and synonyms
Var, TyVar, CoVar, Id, DictId, DFunId, EvVar, EvId, IpId,
module Var (
-- * The main data type and synonyms
Var, TyVar, CoVar, Id, DictId, DFunId, EvVar, EvId, IpId,
@@
-50,7
+56,7
@@
module Var (
mkTyVar, mkTcTyVar, mkWildCoVar,
-- ** Taking 'TyVar's apart
mkTyVar, mkTcTyVar, mkWildCoVar,
-- ** Taking 'TyVar's apart
- tyVarName, tyVarKind, tcTyVarDetails,
+ tyVarName, tyVarKind, tcTyVarDetails, setTcTyVarDetails,
-- ** Modifying 'TyVar's
setTyVarName, setTyVarUnique, setTyVarKind,
-- ** Modifying 'TyVar's
setTyVarName, setTyVarUnique, setTyVarKind,
@@
-131,8
+137,7
@@
data Var
-- Identical to the Unique in the name,
-- cached here for speed
varType :: Kind, -- ^ The type or kind of the 'Var' in question
-- Identical to the Unique in the name,
-- cached here for speed
varType :: Kind, -- ^ The type or kind of the 'Var' in question
- isCoercionVar :: Bool
- }
+ isCoercionVar :: Bool }
| TcTyVar { -- Used only during type inference
-- Used for kind variables during
| TcTyVar { -- Used only during type inference
-- Used for kind variables during
@@
-149,6
+154,7
@@
data Var
idScope :: IdScope,
id_details :: IdDetails, -- Stable, doesn't change
id_info :: IdInfo } -- Unstable, updated by simplifier
idScope :: IdScope,
id_details :: IdDetails, -- Stable, doesn't change
id_info :: IdInfo } -- Unstable, updated by simplifier
+ deriving Typeable
data IdScope -- See Note [GlobalId/LocalId]
= GlobalId
data IdScope -- See Note [GlobalId/LocalId]
= GlobalId
@@
-181,7
+187,8
@@
instance Outputable Var where
ppr var = ppr (varName var) <+> ifPprDebug (brackets (ppr_debug var))
ppr_debug :: Var -> SDoc
ppr var = ppr (varName var) <+> ifPprDebug (brackets (ppr_debug var))
ppr_debug :: Var -> SDoc
-ppr_debug (TyVar {}) = ptext (sLit "tv")
+ppr_debug (TyVar { isCoercionVar = False }) = ptext (sLit "tv")
+ppr_debug (TyVar { isCoercionVar = True }) = ptext (sLit "co")
ppr_debug (TcTyVar {tc_tv_details = d}) = pprTcTyVarDetails d
ppr_debug (Id { idScope = s, id_details = d }) = ppr_id_scope s <> pprIdDetails d
ppr_debug (TcTyVar {tc_tv_details = d}) = pprTcTyVarDetails d
ppr_debug (Id { idScope = s, id_details = d }) = ppr_id_scope s <> pprIdDetails d
@@
-209,8
+216,6
@@
instance Ord Var where
a > b = realUnique a ># realUnique b
a `compare` b = varUnique a `compare` varUnique b
a > b = realUnique a ># realUnique b
a `compare` b = varUnique a `compare` varUnique b
-INSTANCE_TYPEABLE0(Var,varTc,"Var")
-
instance Data Var where
-- don't traverse?
toConstr _ = abstractConstr "Var"
instance Data Var where
-- don't traverse?
toConstr _ = abstractConstr "Var"
@@
-282,6
+287,9
@@
mkTcTyVar name kind details
tcTyVarDetails :: TyVar -> TcTyVarDetails
tcTyVarDetails (TcTyVar { tc_tv_details = details }) = details
tcTyVarDetails var = pprPanic "tcTyVarDetails" (ppr var)
tcTyVarDetails :: TyVar -> TcTyVarDetails
tcTyVarDetails (TcTyVar { tc_tv_details = details }) = details
tcTyVarDetails var = pprPanic "tcTyVarDetails" (ppr var)
+
+setTcTyVarDetails :: TyVar -> TcTyVarDetails -> TyVar
+setTcTyVarDetails tv details = tv { tc_tv_details = details }
\end{code}
%************************************************************************
\end{code}
%************************************************************************