GHC.Types.Var

ghc-lib-parser-9.10.1.20250103: The GHC API, decoupled from GHC versions

Safe Haskell | Ignore
Language | GHC2021

GHC.Types.Var

Contents

- The main data type and synonyms
- In and Out variants
  - Taking `Var`s apart
  - Modifying `Var`s
  - Constructing, taking apart, modifying `Id`s
  - Predicates
- ForAllTyFlags
- FunTyFlag
- PiTyBinder
- TyVar's
  - ExportFlag
  - Constructing TyVar's
  - Taking `TyVar`s apart
  - Modifying `TyVar`s

Description

GHC uses several kinds of name internally:

- `OccName`: see GHC.Types.Name.Occurrence
- `RdrName`: see GHC.Types.Name.Reader
- `Name`: see GHC.Types.Name
- `Id`: see GHC.Types.Id
- `Var` is a synonym for the `Id` type but it may additionally potentially contain type variables, which have a `Kind` rather than a `Type` and only contain some extra details during typechecking.

These `Var` names may either be global or local, see GHC.Types.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
- varMult :: Var -> Mult
- varMultMaybe :: Id -> Maybe Mult
- setVarName :: Var -> Name -> Var
- setVarUnique :: Var -> Unique -> Var
- setVarType :: Var -> Type -> Var
- updateVarType :: (Type -> Type) -> Var -> Var
- updateVarTypeM :: Monad m => (Type -> m Type) -> Var -> m Var
- mkGlobalVar :: IdDetails -> Name -> Type -> IdInfo -> Id
- mkLocalVar :: IdDetails -> Name -> Mult -> 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
- setIdMult :: Id -> Mult -> Id
- updateIdTypeButNotMult :: (Type -> Type) -> Id -> Id
- updateIdTypeAndMult :: (Type -> Type) -> Id -> Id
- updateIdTypeAndMultM :: Monad m => (Type -> m Type) -> Id -> m Id
- isId :: Var -> Bool
- isTyVar :: Var -> Bool
- isTcTyVar :: Var -> Bool
- isLocalVar :: Var -> Bool
- isLocalId :: Var -> Bool
- isLocalId_maybe :: Var -> Maybe ExportFlag
- isCoVar :: Var -> Bool
- isNonCoVarId :: Var -> Bool
- isTyCoVar :: Var -> Bool
- isGlobalId :: Var -> Bool
- isExportedId :: Var -> Bool
- mustHaveLocalBinding :: Var -> Bool
- data ForAllTyFlag where
  - Invisible !Specificity
  - Required
  - pattern Specified :: ForAllTyFlag
  - pattern Inferred :: ForAllTyFlag
- data Specificity
  - = InferredSpec
  - | SpecifiedSpec
- isVisibleForAllTyFlag :: ForAllTyFlag -> Bool
- isInvisibleForAllTyFlag :: ForAllTyFlag -> Bool
- isInferredForAllTyFlag :: ForAllTyFlag -> Bool
- isSpecifiedForAllTyFlag :: ForAllTyFlag -> Bool
- coreTyLamForAllTyFlag :: ForAllTyFlag
- data FunTyFlag
  - = FTF_T_T
  - | FTF_T_C
  - | FTF_C_T
  - | FTF_C_C
- isVisibleFunArg :: FunTyFlag -> Bool
- isInvisibleFunArg :: FunTyFlag -> Bool
- isFUNArg :: FunTyFlag -> Bool
- mkFunTyFlag :: TypeOrConstraint -> TypeOrConstraint -> FunTyFlag
- visArg :: TypeOrConstraint -> FunTyFlag
- invisArg :: TypeOrConstraint -> FunTyFlag
- visArgTypeLike :: FunTyFlag
- visArgConstraintLike :: FunTyFlag
- invisArgTypeLike :: FunTyFlag
- invisArgConstraintLike :: FunTyFlag
- funTyFlagArgTypeOrConstraint :: FunTyFlag -> TypeOrConstraint
- funTyFlagResultTypeOrConstraint :: FunTyFlag -> TypeOrConstraint
- data TypeOrConstraint
  - = TypeLike
  - | ConstraintLike
- data PiTyBinder
  - = Named ForAllTyBinder
  - | Anon (Scaled Type) FunTyFlag
- type PiTyVarBinder = PiTyBinder
- isInvisiblePiTyBinder :: PiTyBinder -> Bool
- isVisiblePiTyBinder :: PiTyBinder -> Bool
- isTyBinder :: PiTyBinder -> Bool
- isNamedPiTyBinder :: PiTyBinder -> Bool
- isAnonPiTyBinder :: PiTyBinder -> Bool
- namedPiTyBinder_maybe :: PiTyBinder -> Maybe TyCoVar
- anonPiTyBinderType_maybe :: PiTyBinder -> Maybe Type
- piTyBinderType :: PiTyBinder -> Type
- data VarBndr var argf = Bndr var argf
- type ForAllTyBinder = VarBndr TyCoVar ForAllTyFlag
- type TyVarBinder = VarBndr TyVar ForAllTyFlag
- type InvisTyBinder = VarBndr TyCoVar Specificity
- type InvisTVBinder = VarBndr TyVar Specificity
- type ReqTyBinder = VarBndr TyCoVar ()
- type ReqTVBinder = VarBndr TyVar ()
- binderVar :: VarBndr tv argf -> tv
- binderVars :: [VarBndr tv argf] -> [tv]
- binderFlag :: VarBndr tv argf -> argf
- binderFlags :: [VarBndr tv argf] -> [argf]
- binderType :: VarBndr TyCoVar argf -> Type
- mkForAllTyBinder :: vis -> TyCoVar -> VarBndr TyCoVar vis
- mkForAllTyBinders :: vis -> [TyCoVar] -> [VarBndr TyCoVar vis]
- mkTyVarBinder :: vis -> TyVar -> VarBndr TyVar vis
- mkTyVarBinders :: vis -> [TyVar] -> [VarBndr TyVar vis]
- isVisibleForAllTyBinder :: ForAllTyBinder -> Bool
- isInvisibleForAllTyBinder :: ForAllTyBinder -> Bool
- isTyVarBinder :: VarBndr TyCoVar vis -> Bool
- tyVarSpecToBinder :: VarBndr a Specificity -> VarBndr a ForAllTyFlag
- tyVarSpecToBinders :: [VarBndr a Specificity] -> [VarBndr a ForAllTyFlag]
- tyVarReqToBinder :: VarBndr a () -> VarBndr a ForAllTyFlag
- tyVarReqToBinders :: [VarBndr a ()] -> [VarBndr a ForAllTyFlag]
- mapVarBndr :: (var -> var') -> VarBndr var flag -> VarBndr var' flag
- mapVarBndrs :: (var -> var') -> [VarBndr var flag] -> [VarBndr var' flag]
- data ExportFlag
  - = NotExported
  - | Exported
- 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

data Var #

Variable

Essentially a typed `Name`, that may also contain some additional information about the `Var` and its use sites.

#### Instances

Instances details

Data Var # |
Instance details Defined in GHC.Types.Var Methods 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 # toConstr :: Var -> Constr # 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 :: forall r r'. (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 #
NamedThing Var # |
Instance details Defined in GHC.Types.Var Methods getOccName :: Var -> OccName # getName :: Var -> Name #
HasOccName Var # |
Instance details Defined in GHC.Types.Var Methods occName :: Var -> OccName #
Uniquable Var # |
Instance details Defined in GHC.Types.Var Methods getUnique :: Var -> Unique #
Outputable Var # |
Instance details Defined in GHC.Types.Var Methods ppr :: Var -> SDoc #
OutputableBndr Var # |
Instance details Defined in GHC.Core.Ppr Methods pprBndr :: BindingSite -> Var -> SDoc # pprPrefixOcc :: Var -> SDoc # pprInfixOcc :: Var -> SDoc # bndrIsJoin_maybe :: Var -> JoinPointHood #
Eq Var # |
Instance details Defined in GHC.Types.Var Methods (==) :: Var -> Var -> Bool # (/=) :: Var -> Var -> Bool #
Ord Var # |
Instance details Defined in GHC.Types.Var Methods compare :: Var -> Var -> Ordering # (<) :: Var -> Var -> Bool # (<=) :: Var -> Var -> Bool # (>) :: Var -> Var -> Bool # (>=) :: Var -> Var -> Bool # max :: Var -> Var -> Var # min :: Var -> Var -> Var #
Eq (DeBruijn CoreAlt) # |
Instance details Defined in GHC.Core.Map.Expr Methods (==) :: DeBruijn CoreAlt -> DeBruijn CoreAlt -> Bool # (/=) :: DeBruijn CoreAlt -> DeBruijn CoreAlt -> Bool #
Eq (DeBruijn CoreExpr) # |
Instance details Defined in GHC.Core.Map.Expr Methods (==) :: DeBruijn CoreExpr -> DeBruijn CoreExpr -> Bool # (/=) :: DeBruijn CoreExpr -> DeBruijn CoreExpr -> Bool #
Eq (DeBruijn Var) # |
Instance details Defined in GHC.Core.Map.Type Methods (==) :: DeBruijn Var -> DeBruijn Var -> Bool # (/=) :: DeBruijn Var -> DeBruijn Var -> Bool #
OutputableBndr (Id, TagSig) # |
Instance details Defined in GHC.Stg.InferTags.TagSig Methods pprBndr :: BindingSite -> (Id, TagSig) -> SDoc # pprPrefixOcc :: (Id, TagSig) -> SDoc # pprInfixOcc :: (Id, TagSig) -> SDoc # bndrIsJoin_maybe :: (Id, TagSig) -> JoinPointHood #
type Anno Id # |
Instance details Defined in GHC.Hs.Extension type Anno Id = SrcSpanAnnN

type CoVar = Id #

Coercion Variable

type Id = Var #

Identifier

type NcId = Id #

type DictId = EvId #

Dictionary Identifier

type DFunId = Id #

Dictionary Function Identifier

type EvVar = EvId #

Evidence Variable

type EqVar = EvId #

Equality Variable

type EvId = Id #

Evidence Identifier

type IpId = EvId #

Implicit parameter Identifier

type JoinId = Id #

type TyVar = Var #

Type or kind Variable

type TcTyVar = Var #

Type variable that might be a metavariable

type TypeVar = Var #

Type Variable

type KindVar = Var #

Kind Variable

type TKVar = Var #

Type or Kind Variable

type TyCoVar = Id #

Type or Coercion Variable

# In and Out variants

type InVar = Var #

type InCoVar = CoVar #

type InId = Id #

type InTyVar = TyVar #

type OutVar = Var #

type OutCoVar = CoVar #

type OutId = Id #

type OutTyVar = TyVar #

## Taking `Var`s apart

varName :: Var -> Name #

varUnique :: Var -> Unique #

varType :: Var -> Kind #

The type or kind of the `Var` in question

varMult :: Var -> Mult #

varMultMaybe :: Id -> Maybe Mult #

## Modifying `Var`s

setVarName :: Var -> Name -> Var #

setVarUnique :: Var -> Unique -> Var #

setVarType :: Var -> Type -> Var #

updateVarType :: (Type -> Type) -> Var -> Var #

Update a `Var`s type. Does not update the multiplicity stored in an `Id`, if any. Because of the possibility for abuse, ASSERTs that there is no multiplicity to update.

updateVarTypeM :: Monad m => (Type -> m Type) -> Var -> m Var #

Update a `Var`s type monadically. Does not update the multiplicity stored in an `Id`, if any. Because of the possibility for abuse, ASSERTs that there is no multiplicity to update.

## Constructing, taking apart, modifying `Id`s

mkGlobalVar :: IdDetails -> Name -> Type -> IdInfo -> Id #

mkLocalVar :: IdDetails -> Name -> Mult -> Type -> IdInfo -> Id #

mkExportedLocalVar :: IdDetails -> Name -> Type -> IdInfo -> Id #

Exported `Var`s will not be removed as dead code

mkCoVar :: Name -> Type -> CoVar #

idInfo :: HasDebugCallStack => Id -> IdInfo #

idDetails :: Id -> IdDetails #

lazySetIdInfo :: Id -> IdInfo -> Var #

setIdDetails :: Id -> IdDetails -> Id #

globaliseId :: Id -> Id #

If it's a local, make it global

setIdExported :: Id -> Id #

Exports the given local `Id`. Can also be called on global `Id`s, such as data constructors and class operations, which are born as global `Id`s and automatically exported

setIdNotExported :: Id -> Id #

We can only do this to LocalIds

setIdMult :: Id -> Mult -> Id #

updateIdTypeButNotMult :: (Type -> Type) -> Id -> Id #

updateIdTypeAndMult :: (Type -> Type) -> Id -> Id #

updateIdTypeAndMultM :: Monad m => (Type -> m Type) -> Id -> m Id #

## Predicates

isId :: Var -> Bool #

Is this a value-level (i.e., computationally relevant) `Id`entifier? Satisfies `isId = not . isTyVar`.

isTyVar :: Var -> Bool #

Is this a type-level (i.e., computationally irrelevant, thus erasable) variable? Satisfies `isTyVar = not . isId`.

isTcTyVar :: Var -> Bool #

isLocalVar :: Var -> Bool #

`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.

isLocalId :: Var -> Bool #

isLocalId_maybe :: Var -> Maybe ExportFlag #

isCoVar :: Var -> Bool #

Is this a coercion variable? Satisfies ``isId` v ==> `isCoVar` v == not (`isNonCoVarId` v)`.

isNonCoVarId :: Var -> Bool #

Is this a term variable (`Id`) that is not a coercion variable? Satisfies ``isId` v ==> `isCoVar` v == not (`isNonCoVarId` v)`.

isTyCoVar :: Var -> Bool #

isGlobalId :: Var -> Bool #

isExportedId :: Var -> Bool #

`isExportedIdVar` means "don't throw this away"

mustHaveLocalBinding :: Var -> Bool #

`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

# ForAllTyFlags

data ForAllTyFlag #

ForAllTyFlag

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, ForAllTyBinders, TyConBinders, and visibility] in GHC.Core.TyCo.Rep

Constructors

Invisible !Specificity |
Required |

Bundled Patterns

pattern Specified :: ForAllTyFlag |
pattern Inferred :: ForAllTyFlag |

#### Instances

Instances details

NFData ForAllTyFlag # |
Instance details Defined in GHC.Types.Var Methods rnf :: ForAllTyFlag -> () #
Data ForAllTyFlag # |
Instance details Defined in GHC.Types.Var Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ForAllTyFlag -> c ForAllTyFlag # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ForAllTyFlag # toConstr :: ForAllTyFlag -> Constr # dataTypeOf :: ForAllTyFlag -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ForAllTyFlag) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ForAllTyFlag) # gmapT :: (forall b. Data b => b -> b) -> ForAllTyFlag -> ForAllTyFlag # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ForAllTyFlag -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ForAllTyFlag -> r # gmapQ :: (forall d. Data d => d -> u) -> ForAllTyFlag -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ForAllTyFlag -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ForAllTyFlag -> m ForAllTyFlag # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ForAllTyFlag -> m ForAllTyFlag # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ForAllTyFlag -> m ForAllTyFlag #
Binary ForAllTyFlag # |
Instance details Defined in GHC.Types.Var Methods put_ :: BinHandle -> ForAllTyFlag -> IO () # put :: BinHandle -> ForAllTyFlag -> IO (Bin ForAllTyFlag) # get :: BinHandle -> IO ForAllTyFlag #
Outputable ForAllTyFlag # |
Instance details Defined in GHC.Types.Var Methods ppr :: ForAllTyFlag -> SDoc #
Eq ForAllTyFlag # |
Instance details Defined in GHC.Types.Var Methods (==) :: ForAllTyFlag -> ForAllTyFlag -> Bool # (/=) :: ForAllTyFlag -> ForAllTyFlag -> Bool #
Ord ForAllTyFlag # |
Instance details Defined in GHC.Types.Var Methods compare :: ForAllTyFlag -> ForAllTyFlag -> Ordering # (<) :: ForAllTyFlag -> ForAllTyFlag -> Bool # (<=) :: ForAllTyFlag -> ForAllTyFlag -> Bool # (>) :: ForAllTyFlag -> ForAllTyFlag -> Bool # (>=) :: ForAllTyFlag -> ForAllTyFlag -> Bool # max :: ForAllTyFlag -> ForAllTyFlag -> ForAllTyFlag # min :: ForAllTyFlag -> ForAllTyFlag -> ForAllTyFlag #
Outputable tv => Outputable (VarBndr tv ForAllTyFlag) # |
Instance details Defined in GHC.Types.Var Methods ppr :: VarBndr tv ForAllTyFlag -> SDoc #

data Specificity #

Whether an `Invisible` argument may appear in source Haskell.

Constructors

InferredSpec | the argument may not appear in source Haskell, it is only inferred.
SpecifiedSpec | the argument may appear in source Haskell, but isn't required.

#### Instances

Instances details

NFData Specificity # |
Instance details Defined in GHC.Types.Var Methods rnf :: Specificity -> () #
Data Specificity # |
Instance details Defined in GHC.Types.Var Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Specificity -> c Specificity # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Specificity # toConstr :: Specificity -> Constr # dataTypeOf :: Specificity -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Specificity) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Specificity) # gmapT :: (forall b. Data b => b -> b) -> Specificity -> Specificity # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Specificity -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Specificity -> r # gmapQ :: (forall d. Data d => d -> u) -> Specificity -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Specificity -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Specificity -> m Specificity # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Specificity -> m Specificity # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Specificity -> m Specificity #
Binary Specificity # |
Instance details Defined in GHC.Types.Var Methods put_ :: BinHandle -> Specificity -> IO () # put :: BinHandle -> Specificity -> IO (Bin Specificity) # get :: BinHandle -> IO Specificity #
Eq Specificity # |
Instance details Defined in GHC.Types.Var Methods (==) :: Specificity -> Specificity -> Bool # (/=) :: Specificity -> Specificity -> Bool #
Ord Specificity # |
Instance details Defined in GHC.Types.Var Methods compare :: Specificity -> Specificity -> Ordering # (<) :: Specificity -> Specificity -> Bool # (<=) :: Specificity -> Specificity -> Bool # (>) :: Specificity -> Specificity -> Bool # (>=) :: Specificity -> Specificity -> Bool # max :: Specificity -> Specificity -> Specificity # min :: Specificity -> Specificity -> Specificity #
OutputableBndrFlag Specificity p # |
Instance details Defined in GHC.Hs.Type Methods pprTyVarBndr :: HsTyVarBndr Specificity (GhcPass p) -> SDoc
Outputable tv => Outputable (VarBndr tv Specificity) # |
Instance details Defined in GHC.Types.Var Methods ppr :: VarBndr tv Specificity -> SDoc #

isVisibleForAllTyFlag :: ForAllTyFlag -> Bool #

Does this `ForAllTyFlag` classify an argument that is written in Haskell?

isInvisibleForAllTyFlag :: ForAllTyFlag -> Bool #

Does this `ForAllTyFlag` classify an argument that is not written in Haskell?

isInferredForAllTyFlag :: ForAllTyFlag -> Bool #

isSpecifiedForAllTyFlag :: ForAllTyFlag -> Bool #

coreTyLamForAllTyFlag :: ForAllTyFlag #

The ForAllTyFlag on a (Lam a e) term, where `a` is a type variable. If you want other ForAllTyFlag, use a cast. See Note [ForAllCo] in GHC.Core.TyCo.Rep

# FunTyFlag

data FunTyFlag #

The non-dependent version of `ForAllTyFlag`. See Note [FunTyFlag] Appears here partly so that it's together with its friends ForAllTyFlag and ForallVisFlag, but also because it is used in IfaceType, rather early in the compilation chain

Constructors

FTF_T_T |
FTF_T_C |
FTF_C_T |
FTF_C_C |

#### Instances

Instances details

Data FunTyFlag # |
Instance details Defined in GHC.Types.Var Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> FunTyFlag -> c FunTyFlag # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c FunTyFlag # toConstr :: FunTyFlag -> Constr # dataTypeOf :: FunTyFlag -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c FunTyFlag) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FunTyFlag) # gmapT :: (forall b. Data b => b -> b) -> FunTyFlag -> FunTyFlag # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FunTyFlag -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FunTyFlag -> r # gmapQ :: (forall d. Data d => d -> u) -> FunTyFlag -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> FunTyFlag -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> FunTyFlag -> m FunTyFlag # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> FunTyFlag -> m FunTyFlag # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> FunTyFlag -> m FunTyFlag #
Binary FunTyFlag # |
Instance details Defined in GHC.Types.Var Methods put_ :: BinHandle -> FunTyFlag -> IO () # put :: BinHandle -> FunTyFlag -> IO (Bin FunTyFlag) # get :: BinHandle -> IO FunTyFlag #
Outputable FunTyFlag # |
Instance details Defined in GHC.Types.Var Methods ppr :: FunTyFlag -> SDoc #
Eq FunTyFlag # |
Instance details Defined in GHC.Types.Var Methods (==) :: FunTyFlag -> FunTyFlag -> Bool # (/=) :: FunTyFlag -> FunTyFlag -> Bool #
Ord FunTyFlag # |
Instance details Defined in GHC.Types.Var Methods compare :: FunTyFlag -> FunTyFlag -> Ordering # (<) :: FunTyFlag -> FunTyFlag -> Bool # (<=) :: FunTyFlag -> FunTyFlag -> Bool # (>) :: FunTyFlag -> FunTyFlag -> Bool # (>=) :: FunTyFlag -> FunTyFlag -> Bool # max :: FunTyFlag -> FunTyFlag -> FunTyFlag # min :: FunTyFlag -> FunTyFlag -> FunTyFlag #

isVisibleFunArg :: FunTyFlag -> Bool #

isInvisibleFunArg :: FunTyFlag -> Bool #

isFUNArg :: FunTyFlag -> Bool #

mkFunTyFlag :: TypeOrConstraint -> TypeOrConstraint -> FunTyFlag #

visArg :: TypeOrConstraint -> FunTyFlag #

invisArg :: TypeOrConstraint -> FunTyFlag #

visArgTypeLike :: FunTyFlag #

visArgConstraintLike :: FunTyFlag #

invisArgTypeLike :: FunTyFlag #

invisArgConstraintLike :: FunTyFlag #

funTyFlagArgTypeOrConstraint :: FunTyFlag -> TypeOrConstraint #

funTyFlagResultTypeOrConstraint :: FunTyFlag -> TypeOrConstraint #

data TypeOrConstraint #

Constructors

TypeLike |
ConstraintLike |

#### Instances

Instances details

Data TypeOrConstraint # |
Instance details Defined in GHC.Types.Basic Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TypeOrConstraint -> c TypeOrConstraint # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TypeOrConstraint # toConstr :: TypeOrConstraint -> Constr # dataTypeOf :: TypeOrConstraint -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TypeOrConstraint) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeOrConstraint) # gmapT :: (forall b. Data b => b -> b) -> TypeOrConstraint -> TypeOrConstraint # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TypeOrConstraint -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TypeOrConstraint -> r # gmapQ :: (forall d. Data d => d -> u) -> TypeOrConstraint -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> TypeOrConstraint -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TypeOrConstraint -> m TypeOrConstraint # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TypeOrConstraint -> m TypeOrConstraint # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TypeOrConstraint -> m TypeOrConstraint #
Eq TypeOrConstraint # |
Instance details Defined in GHC.Types.Basic Methods (==) :: TypeOrConstraint -> TypeOrConstraint -> Bool # (/=) :: TypeOrConstraint -> TypeOrConstraint -> Bool #
Ord TypeOrConstraint # |
Instance details Defined in GHC.Types.Basic Methods compare :: TypeOrConstraint -> TypeOrConstraint -> Ordering # (<) :: TypeOrConstraint -> TypeOrConstraint -> Bool # (<=) :: TypeOrConstraint -> TypeOrConstraint -> Bool # (>) :: TypeOrConstraint -> TypeOrConstraint -> Bool # (>=) :: TypeOrConstraint -> TypeOrConstraint -> Bool # max :: TypeOrConstraint -> TypeOrConstraint -> TypeOrConstraint # min :: TypeOrConstraint -> TypeOrConstraint -> TypeOrConstraint #

# PiTyBinder

data PiTyBinder #

A `PiTyBinder` represents an argument to a function. PiTyBinders can be dependent (`Named`) or nondependent (`Anon`). They may also be visible or not. See Note [PiTyBinders]

Constructors

Named ForAllTyBinder |
Anon (Scaled Type) FunTyFlag |

#### Instances

Instances details

Data PiTyBinder # |
Instance details Defined in GHC.Types.Var Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> PiTyBinder -> c PiTyBinder # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c PiTyBinder # toConstr :: PiTyBinder -> Constr # dataTypeOf :: PiTyBinder -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c PiTyBinder) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PiTyBinder) # gmapT :: (forall b. Data b => b -> b) -> PiTyBinder -> PiTyBinder # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PiTyBinder -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PiTyBinder -> r # gmapQ :: (forall d. Data d => d -> u) -> PiTyBinder -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> PiTyBinder -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> PiTyBinder -> m PiTyBinder # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PiTyBinder -> m PiTyBinder # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PiTyBinder -> m PiTyBinder #
Outputable PiTyBinder # |
Instance details Defined in GHC.Types.Var Methods ppr :: PiTyBinder -> SDoc #

type PiTyVarBinder = PiTyBinder #

`PiTyVarBinder` is like `PiTyBinder`, but there can only be `TyVar` in the `Named` field.

isInvisiblePiTyBinder :: PiTyBinder -> Bool #

Does this binder bind an invisible argument?

isVisiblePiTyBinder :: PiTyBinder -> Bool #

Does this binder bind a visible argument?

isTyBinder :: PiTyBinder -> Bool #

If its a named binder, is the binder a tyvar? Returns True for nondependent binder. This check that we're really returning a *Ty*Binder (as opposed to a coercion binder). That way, if/when we allow coercion quantification in more places, we'll know we missed updating some function.

isNamedPiTyBinder :: PiTyBinder -> Bool #

isAnonPiTyBinder :: PiTyBinder -> Bool #

Does this binder bind a variable that is not erased? Returns `True` for anonymous binders.

namedPiTyBinder_maybe :: PiTyBinder -> Maybe TyCoVar #

anonPiTyBinderType_maybe :: PiTyBinder -> Maybe Type #

Extract a relevant type, if there is one.

piTyBinderType :: PiTyBinder -> Type #

# TyVar's

data VarBndr var argf #

Constructors

Bndr var argf |

#### Instances

Instances details

(Data var, Data argf) => Data (VarBndr var argf) # |
Instance details Defined in GHC.Types.Var Methods 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 :: forall r r'. (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) #
NamedThing tv => NamedThing (VarBndr tv flag) # |
Instance details Defined in GHC.Types.Var Methods getOccName :: VarBndr tv flag -> OccName # getName :: VarBndr tv flag -> Name #
(Binary tv, Binary vis) => Binary (VarBndr tv vis) # |
Instance details Defined in GHC.Types.Var Methods put_ :: BinHandle -> VarBndr tv vis -> IO () # put :: BinHandle -> VarBndr tv vis -> IO (Bin (VarBndr tv vis)) # get :: BinHandle -> IO (VarBndr tv vis) #
OutputableBndr tv => Outputable (VarBndr tv TyConBndrVis) # |
Instance details Defined in GHC.Core.TyCon Methods ppr :: VarBndr tv TyConBndrVis -> SDoc #
Outputable tv => Outputable (VarBndr tv ForAllTyFlag) # |
Instance details Defined in GHC.Types.Var Methods ppr :: VarBndr tv ForAllTyFlag -> SDoc #
Outputable tv => Outputable (VarBndr tv Specificity) # |
Instance details Defined in GHC.Types.Var Methods ppr :: VarBndr tv Specificity -> SDoc #

type ForAllTyBinder = VarBndr TyCoVar ForAllTyFlag #

Variable Binder

A `ForAllTyBinder` is the binder of a ForAllTy It's convenient to define this synonym here rather its natural home in GHC.Core.TyCo.Rep, because it's used in GHC.Core.DataCon.hs-boot

A `TyVarBinder` is a binder with only TyVar

type TyVarBinder = VarBndr TyVar ForAllTyFlag #

type InvisTyBinder = VarBndr TyCoVar Specificity #

type InvisTVBinder = VarBndr TyVar Specificity #

type ReqTyBinder = VarBndr TyCoVar () #

type ReqTVBinder = VarBndr TyVar () #

binderVar :: VarBndr tv argf -> tv #

binderVars :: [VarBndr tv argf] -> [tv] #

binderFlag :: VarBndr tv argf -> argf #

binderFlags :: [VarBndr tv argf] -> [argf] #

binderType :: VarBndr TyCoVar argf -> Type #

mkForAllTyBinder :: vis -> TyCoVar -> VarBndr TyCoVar vis #

Make a named binder

mkForAllTyBinders :: vis -> [TyCoVar] -> [VarBndr TyCoVar vis] #

Make many named binders

mkTyVarBinder :: vis -> TyVar -> VarBndr TyVar vis #

Make a named binder `var` should be a type variable

mkTyVarBinders :: vis -> [TyVar] -> [VarBndr TyVar vis] #

Make many named binders Input vars should be type variables

isVisibleForAllTyBinder :: ForAllTyBinder -> Bool #

isInvisibleForAllTyBinder :: ForAllTyBinder -> Bool #

isTyVarBinder :: VarBndr TyCoVar vis -> Bool #

tyVarSpecToBinder :: VarBndr a Specificity -> VarBndr a ForAllTyFlag #

tyVarSpecToBinders :: [VarBndr a Specificity] -> [VarBndr a ForAllTyFlag] #

tyVarReqToBinder :: VarBndr a () -> VarBndr a ForAllTyFlag #

tyVarReqToBinders :: [VarBndr a ()] -> [VarBndr a ForAllTyFlag] #

mapVarBndr :: (var -> var') -> VarBndr var flag -> VarBndr var' flag #

mapVarBndrs :: (var -> var') -> [VarBndr var flag] -> [VarBndr var' flag] #

## ExportFlag

data ExportFlag #

Constructors

NotExported | Not exported: may be discarded as dead code.
Exported | Exported: kept alive

## Constructing TyVar's

mkTyVar :: Name -> Kind -> TyVar #

mkTcTyVar :: Name -> Kind -> TcTyVarDetails -> TyVar #

## Taking `TyVar`s apart

tyVarName :: TyVar -> Name #

tyVarKind :: TyVar -> Kind #

tcTyVarDetails :: TyVar -> TcTyVarDetails #

setTcTyVarDetails :: TyVar -> TcTyVarDetails -> TyVar #

## Modifying `TyVar`s

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 #

Compare Vars by their Uniques. This is what Ord Var does, provided here to make it explicit at the call-site that it can introduce non-determinism. See Note [Unique Determinism]