Safe Haskell | None |
---|---|
Language | Haskell2010 |
GHC uses several kinds of name internally:
OccName
: see OccNameRdrName
: see RdrNameName
: see NameId
: see IdVar
is a synonym for theId
type but it may additionally potentially contain type variables, which have aKind
rather than aType
and only contain some extra details during typechecking.
These Var
names may either be global or local, see Var
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.
Synopsis
- data Var
- type CoVar = Id
- type Id = Var
- type NcId = Id
- type DictId = EvId
- type DFunId = Id
- type EvVar = EvId
- type EqVar = EvId
- type EvId = Id
- type IpId = EvId
- type JoinId = Id
- type TyVar = Var
- type TcTyVar = Var
- type TypeVar = Var
- type KindVar = Var
- type TKVar = Var
- type TyCoVar = Id
- type InVar = Var
- type InCoVar = CoVar
- type InId = Id
- type InTyVar = TyVar
- type OutVar = Var
- type OutCoVar = CoVar
- type OutId = Id
- type OutTyVar = TyVar
- varName :: Var -> Name
- varUnique :: Var -> Unique
- varType :: Var -> Kind
- setVarName :: Var -> Name -> Var
- setVarUnique :: Var -> Unique -> Var
- setVarType :: Id -> Type -> Id
- updateVarType :: (Type -> Type) -> Id -> Id
- updateVarTypeM :: Monad m => (Type -> m Type) -> Id -> m Id
- mkGlobalVar :: IdDetails -> Name -> Type -> IdInfo -> Id
- mkLocalVar :: IdDetails -> Name -> Type -> IdInfo -> Id
- mkExportedLocalVar :: IdDetails -> Name -> Type -> IdInfo -> Id
- mkCoVar :: Name -> Type -> CoVar
- idInfo :: HasDebugCallStack => Id -> IdInfo
- idDetails :: Id -> IdDetails
- lazySetIdInfo :: Id -> IdInfo -> Var
- setIdDetails :: Id -> IdDetails -> Id
- globaliseId :: Id -> Id
- setIdExported :: Id -> Id
- setIdNotExported :: Id -> Id
- isId :: Var -> Bool
- isTyVar :: Var -> Bool
- isTcTyVar :: Var -> Bool
- isLocalVar :: Var -> Bool
- isLocalId :: Var -> Bool
- isCoVar :: Var -> Bool
- isNonCoVarId :: Var -> Bool
- isTyCoVar :: Var -> Bool
- isGlobalId :: Var -> Bool
- isExportedId :: Var -> Bool
- mustHaveLocalBinding :: Var -> Bool
- data VarBndr var argf = Bndr var argf
- data ArgFlag
- type TyCoVarBinder = VarBndr TyCoVar ArgFlag
- type TyVarBinder = VarBndr TyVar ArgFlag
- binderVar :: VarBndr tv argf -> tv
- binderVars :: [VarBndr tv argf] -> [tv]
- binderArgFlag :: VarBndr tv argf -> argf
- binderType :: VarBndr TyCoVar argf -> Type
- isVisibleArgFlag :: ArgFlag -> Bool
- isInvisibleArgFlag :: ArgFlag -> Bool
- sameVis :: ArgFlag -> ArgFlag -> Bool
- mkTyCoVarBinder :: ArgFlag -> TyCoVar -> TyCoVarBinder
- mkTyCoVarBinders :: ArgFlag -> [TyCoVar] -> [TyCoVarBinder]
- mkTyVarBinder :: ArgFlag -> TyVar -> TyVarBinder
- mkTyVarBinders :: ArgFlag -> [TyVar] -> [TyVarBinder]
- isTyVarBinder :: TyCoVarBinder -> Bool
- mkTyVar :: Name -> Kind -> TyVar
- mkTcTyVar :: Name -> Kind -> TcTyVarDetails -> TyVar
- tyVarName :: TyVar -> Name
- tyVarKind :: TyVar -> Kind
- tcTyVarDetails :: TyVar -> TcTyVarDetails
- setTcTyVarDetails :: TyVar -> TcTyVarDetails -> TyVar
- setTyVarName :: TyVar -> Name -> TyVar
- setTyVarUnique :: TyVar -> Unique -> TyVar
- setTyVarKind :: TyVar -> Kind -> TyVar
- updateTyVarKind :: (Kind -> Kind) -> TyVar -> TyVar
- updateTyVarKindM :: Monad m => (Kind -> m Kind) -> TyVar -> m TyVar
- nonDetCmpVar :: Var -> Var -> Ordering
The main data type and synonyms
Variable
Essentially a typed Name
, that may also contain some additional information
about the Var
and its use sites.
Instances
Eq Var Source # | |
Data Var Source # | |
Defined in Var gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Var -> c Var # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Var # dataTypeOf :: Var -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Var) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Var) # gmapT :: (forall b. Data b => b -> b) -> Var -> Var # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Var -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Var -> r # gmapQ :: (forall d. Data d => d -> u) -> Var -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Var -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Var -> m Var # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Var -> m Var # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Var -> m Var # | |
Ord Var Source # | |
OutputableBndr Var Source # | |
Outputable Var Source # | |
Uniquable Var Source # | |
HasOccName Var Source # | |
NamedThing Var Source # | |
In and Out variants
Taking Var
s apart
Modifying Var
s
Constructing, taking apart, modifying Id
s
mkExportedLocalVar :: IdDetails -> Name -> Type -> IdInfo -> Id Source #
Exported Var
s will not be removed as dead code
globaliseId :: Id -> Id Source #
If it's a local, make it global
setIdExported :: Id -> Id Source #
setIdNotExported :: Id -> Id Source #
We can only do this to LocalIds
Predicates
isLocalVar :: Var -> Bool Source #
isLocalVar
returns True
for type variables as well as local Id
s
These are the variables that we need to pay attention to when finding free
variables, or doing dependency analysis.
isNonCoVarId :: Var -> Bool Source #
isGlobalId :: Var -> Bool Source #
isExportedId :: Var -> Bool Source #
isExportedIdVar
means "don't throw this away"
mustHaveLocalBinding :: Var -> Bool Source #
mustHaveLocalBinding
returns True
of Id
s and TyVar
s
that must have a binding in this module. The converse
is not quite right: there are some global Id
s that must have
bindings, such as record selectors. But that doesn't matter,
because it's only used for assertions
TyVar's
data VarBndr var argf Source #
Bndr var argf |
Instances
(Data var, Data argf) => Data (VarBndr var argf) Source # | |
Defined in Var gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> VarBndr var argf -> c (VarBndr var argf) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (VarBndr var argf) # toConstr :: VarBndr var argf -> Constr # dataTypeOf :: VarBndr var argf -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (VarBndr var argf)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (VarBndr var argf)) # gmapT :: (forall b. Data b => b -> b) -> VarBndr var argf -> VarBndr var argf # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> VarBndr var argf -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> VarBndr var argf -> r # gmapQ :: (forall d. Data d => d -> u) -> VarBndr var argf -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> VarBndr var argf -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> VarBndr var argf -> m (VarBndr var argf) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> VarBndr var argf -> m (VarBndr var argf) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> VarBndr var argf -> m (VarBndr var argf) # | |
Outputable tv => Outputable (VarBndr tv ArgFlag) Source # | |
Outputable tv => Outputable (VarBndr tv TyConBndrVis) Source # | |
(Binary tv, Binary vis) => Binary (VarBndr tv vis) Source # | |
NamedThing tv => NamedThing (VarBndr tv flag) Source # | |
Argument Flag
Is something required to appear in source Haskell (Required
),
permitted by request (Specified
) (visible type application), or
prohibited entirely from appearing in source Haskell (Inferred
)?
See Note [VarBndrs, TyCoVarBinders, TyConBinders, and visibility] in TyCoRep
Instances
Eq ArgFlag Source # | |
Data ArgFlag Source # | |
Defined in Var gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ArgFlag -> c ArgFlag # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ArgFlag # toConstr :: ArgFlag -> Constr # dataTypeOf :: ArgFlag -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ArgFlag) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ArgFlag) # gmapT :: (forall b. Data b => b -> b) -> ArgFlag -> ArgFlag # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ArgFlag -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ArgFlag -> r # gmapQ :: (forall d. Data d => d -> u) -> ArgFlag -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ArgFlag -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ArgFlag -> m ArgFlag # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ArgFlag -> m ArgFlag # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ArgFlag -> m ArgFlag # | |
Ord ArgFlag Source # | |
Outputable ArgFlag Source # | |
Binary ArgFlag Source # | |
Outputable tv => Outputable (VarBndr tv ArgFlag) Source # | |
type TyCoVarBinder = VarBndr TyCoVar ArgFlag Source #
Variable Binder
A TyCoVarBinder
is the binder of a ForAllTy
It's convenient to define this synonym here rather its natural
home in TyCoRep, because it's used in DataCon.hs-boot
A TyVarBinder
is a binder with only TyVar
binderVars :: [VarBndr tv argf] -> [tv] Source #
binderArgFlag :: VarBndr tv argf -> argf Source #
isVisibleArgFlag :: ArgFlag -> Bool Source #
Does this ArgFlag
classify an argument that is written in Haskell?
isInvisibleArgFlag :: ArgFlag -> Bool Source #
Does this ArgFlag
classify an argument that is not written in Haskell?
mkTyCoVarBinder :: ArgFlag -> TyCoVar -> TyCoVarBinder Source #
Make a named binder
mkTyCoVarBinders :: ArgFlag -> [TyCoVar] -> [TyCoVarBinder] Source #
Make many named binders
mkTyVarBinder :: ArgFlag -> TyVar -> TyVarBinder Source #
Make a named binder
var
should be a type variable
mkTyVarBinders :: ArgFlag -> [TyVar] -> [TyVarBinder] Source #
Make many named binders Input vars should be type variables
isTyVarBinder :: TyCoVarBinder -> Bool Source #
Constructing TyVar's
Taking TyVar
s apart
tcTyVarDetails :: TyVar -> TcTyVarDetails Source #
setTcTyVarDetails :: TyVar -> TcTyVarDetails -> TyVar Source #