- varType :: Type,
- varDetails :: VarDetails,
- varInfo :: IdInfo -- Only used for Ids at the moment
- }
-
-data VarDetails
- = LocalId -- Used for locally-defined Ids (see NOTE below)
- LocalIdDetails
-
- | GlobalId -- Used for imported Ids, dict selectors etc
- GlobalIdDetails
-
- | TyVar
- | MutTyVar (IORef (Maybe Type)) -- Used during unification;
- TyVarDetails
- -- TODO: the IORef should be unboxed here, but we don't want to unbox
- -- the Name above.
-
- -- For a long time I tried to keep mutable Vars statically
- -- type-distinct from immutable Vars, but I've finally given
- -- up. It's just too painful. After type checking there are
- -- no MutTyVars left, but there's no static check of that
- -- fact.
+ tyVarKind :: Kind }
+
+ | TcTyVar { -- Used only during type inference
+ varName :: !Name, -- Could we get away without a Name?
+ realUnique :: FastInt,
+ tyVarKind :: Kind,
+ tcTyVarRef :: IORef (Maybe Type),
+ tcTyVarDetails :: TyVarDetails }
+
+ | GlobalId { -- Used for imported Ids, dict selectors etc
+ varName :: !Name,
+ realUnique :: FastInt,
+ idType :: Type,
+ idInfo :: IdInfo,
+ gblDetails :: GlobalIdDetails }
+
+ | LocalId { -- Used for locally-defined Ids (see NOTE below)
+ varName :: !Name,
+ realUnique :: FastInt,
+ idType :: Type,
+ idInfo :: IdInfo,
+ lclDetails :: LocalIdDetails }