ghc-9.6.3: The GHC API

Safe Haskell | Safe-Inferred
Language | Haskell2010

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 `Var`s
  - Predicates
- ForAllTyFlags
- FunTyFlag
- PiTyBinder
- TyVar's
  - Constructing TyVar's
  - Taking `Var`s apart
  - Modifying `Var`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 `Var`s and `Var`s are those that are imported or correspond to a data constructor, primitive operation, or record selectors. Local `Var`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
- 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
- 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
- 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]
- 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]
- 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 Source #

Variable

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

#### Instances

Instances details

Data Var Source # |

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 Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Var Source #

toConstr :: Var -> Constr Source #

dataTypeOf :: Var -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Var) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Var) Source #

gmapT :: (forall b. Data b => b -> b) -> Var -> Var Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Var -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Var -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Var -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Var -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Var -> m Var Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Var -> m Var Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Var -> m Var Source #

NamedThing Var Source # |
Instance details Defined in GHC.Types.Var Methods getOccName :: Var -> OccName Source # getName :: Var -> Name Source #
HasOccName Var Source # |
Instance details Defined in GHC.Types.Var Methods occName :: Var -> OccName Source #
Uniquable Var Source # |
Instance details Defined in GHC.Types.Var Methods getUnique :: Var -> Unique Source #
Outputable Var Source # |
Instance details Defined in GHC.Types.Var Methods ppr :: Var -> SDoc Source #
OutputableBndr Var Source # |
Instance details Defined in GHC.Core.Ppr Methods pprBndr :: BindingSite -> Var -> SDoc Source # pprPrefixOcc :: Var -> SDoc Source # pprInfixOcc :: Var -> SDoc Source # bndrIsJoin_maybe :: Var -> Maybe Int Source #
Eq Var Source # |
Instance details Defined in GHC.Types.Var Methods (==) :: Var -> Var -> Bool # (/=) :: Var -> Var -> Bool #
Ord Var Source # |
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) Source # |
Instance details Defined in GHC.Core.Map.Expr Methods (==) :: DeBruijn CoreAlt -> DeBruijn CoreAlt -> Bool # (/=) :: DeBruijn CoreAlt -> DeBruijn CoreAlt -> Bool #
Eq (DeBruijn CoreExpr) Source # |
Instance details Defined in GHC.Core.Map.Expr Methods (==) :: DeBruijn CoreExpr -> DeBruijn CoreExpr -> Bool # (/=) :: DeBruijn CoreExpr -> DeBruijn CoreExpr -> Bool #
Eq (DeBruijn Var) Source # |
Instance details Defined in GHC.Core.Map.Type Methods (==) :: DeBruijn Var -> DeBruijn Var -> Bool # (/=) :: DeBruijn Var -> DeBruijn Var -> Bool #
OutputableBndr (Id, TagSig) Source # |
Instance details Defined in GHC.Stg.InferTags.TagSig Methods pprBndr :: BindingSite -> (Id, TagSig) -> SDoc Source # pprPrefixOcc :: (Id, TagSig) -> SDoc Source # pprInfixOcc :: (Id, TagSig) -> SDoc Source # bndrIsJoin_maybe :: (Id, TagSig) -> Maybe Int Source #
type Anno Id Source # |
Instance details Defined in GHC.Hs.Extension type Anno Id = SrcSpanAnnN
type Anno (LocatedN Id) Source # |
Instance details Defined in GHC.Hs.Binds type Anno (LocatedN Id) = SrcSpan
type Anno [LocatedN Id] Source # |
Instance details Defined in GHC.Hs.Binds type Anno [LocatedN Id] = SrcSpan

type CoVar = Id Source #

Coercion Variable

type Id = Var Source #

Identifier

type NcId = Id Source #

type DictId = EvId Source #

Dictionary Identifier

type DFunId = Id Source #

Dictionary Function Identifier

type EvVar = EvId Source #

Evidence Variable

type EqVar = EvId Source #

Equality Variable

type EvId = Id Source #

Evidence Identifier

type IpId = EvId Source #

Implicit parameter Identifier

type JoinId = Id Source #

type TyVar = Var Source #

Type or kind Variable

type TcTyVar = Var Source #

Type variable that might be a metavariable

type TypeVar = Var Source #

Type Variable

type KindVar = Var Source #

Kind Variable

type TKVar = Var Source #

Type or Kind Variable

type TyCoVar = Id Source #

Type or Coercion Variable

# In and Out variants

type InVar = Var Source #

type InCoVar = CoVar Source #

type InId = Id Source #

type InTyVar = TyVar Source #

type OutVar = Var Source #

type OutCoVar = CoVar Source #

type OutId = Id Source #

type OutTyVar = TyVar Source #

## Taking `Var`s apart

varName :: Var -> Name Source #

varUnique :: Var -> Unique Source #

varType :: Var -> Kind Source #

The type or kind of the `Var` in question

varMult :: Var -> Mult Source #

varMultMaybe :: Id -> Maybe Mult Source #

## Modifying `Var`s

setVarName :: Var -> Name -> Var Source #

setVarUnique :: Var -> Unique -> Var Source #

setVarType :: Var -> Type -> Var Source #

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

Update a `Var`s type. Does not update the multiplicity stored in an `Var`, 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 Source #

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

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

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

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

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

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

mkCoVar :: Name -> Type -> CoVar Source #

idInfo :: HasDebugCallStack => Id -> IdInfo Source #

idDetails :: Id -> IdDetails Source #

lazySetIdInfo :: Id -> IdInfo -> Var Source #

setIdDetails :: Id -> IdDetails -> Id Source #

globaliseId :: Id -> Id Source #

If it's a local, make it global

setIdExported :: Id -> Id Source #

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

setIdNotExported :: Id -> Id Source #

We can only do this to LocalIds

setIdMult :: Id -> Mult -> Id Source #

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

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

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

## Predicates

isId :: Var -> Bool Source #

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

isTyVar :: Var -> Bool Source #

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

isTcTyVar :: Var -> Bool Source #

isLocalVar :: Var -> Bool Source #

`isLocalVar` returns `True` for type variables as well as local `Var`s These are the variables that we need to pay attention to when finding free variables, or doing dependency analysis.

isLocalId :: Var -> Bool Source #

isCoVar :: Var -> Bool Source #

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

isNonCoVarId :: Var -> Bool Source #

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

isTyCoVar :: 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 `Var`s and `Var`s that must have a binding in this module. The converse is not quite right: there are some global `Var`s that must have bindings, such as record selectors. But that doesn't matter, because it's only used for assertions

# ForAllTyFlags

data ForAllTyFlag Source #

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

Data ForAllTyFlag Source # |

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 Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ForAllTyFlag Source #

toConstr :: ForAllTyFlag -> Constr Source #

dataTypeOf :: ForAllTyFlag -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ForAllTyFlag) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ForAllTyFlag) Source #

gmapT :: (forall b. Data b => b -> b) -> ForAllTyFlag -> ForAllTyFlag Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ForAllTyFlag -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ForAllTyFlag -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> ForAllTyFlag -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> ForAllTyFlag -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> ForAllTyFlag -> m ForAllTyFlag Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ForAllTyFlag -> m ForAllTyFlag Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ForAllTyFlag -> m ForAllTyFlag Source #

Binary ForAllTyFlag Source # |
Instance details Defined in GHC.Types.Var Methods put_ :: BinHandle -> ForAllTyFlag -> IO () Source # put :: BinHandle -> ForAllTyFlag -> IO (Bin ForAllTyFlag) Source # get :: BinHandle -> IO ForAllTyFlag Source #
Outputable ForAllTyFlag Source # |
Instance details Defined in GHC.Types.Var Methods ppr :: ForAllTyFlag -> SDoc Source #
Eq ForAllTyFlag Source # |
Instance details Defined in GHC.Types.Var Methods (==) :: ForAllTyFlag -> ForAllTyFlag -> Bool # (/=) :: ForAllTyFlag -> ForAllTyFlag -> Bool #
Ord ForAllTyFlag Source # |
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) Source # |
Instance details Defined in GHC.Types.Var Methods ppr :: VarBndr tv ForAllTyFlag -> SDoc Source #

data Specificity Source #

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

Data Specificity Source # |

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 Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Specificity Source #

toConstr :: Specificity -> Constr Source #

dataTypeOf :: Specificity -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Specificity) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Specificity) Source #

gmapT :: (forall b. Data b => b -> b) -> Specificity -> Specificity Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Specificity -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Specificity -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Specificity -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Specificity -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Specificity -> m Specificity Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Specificity -> m Specificity Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Specificity -> m Specificity Source #

Binary Specificity Source # |
Instance details Defined in GHC.Types.Var Methods put_ :: BinHandle -> Specificity -> IO () Source # put :: BinHandle -> Specificity -> IO (Bin Specificity) Source # get :: BinHandle -> IO Specificity Source #
Eq Specificity Source # |
Instance details Defined in GHC.Types.Var Methods (==) :: Specificity -> Specificity -> Bool # (/=) :: Specificity -> Specificity -> Bool #
Ord Specificity Source # |
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 Source # |
Instance details Defined in GHC.Hs.Type Methods pprTyVarBndr :: HsTyVarBndr Specificity (GhcPass p) -> SDoc
Outputable tv => Outputable (VarBndr tv Specificity) Source # |
Instance details Defined in GHC.Types.Var Methods ppr :: VarBndr tv Specificity -> SDoc Source #

isVisibleForAllTyFlag :: ForAllTyFlag -> Bool Source #

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

isInvisibleForAllTyFlag :: ForAllTyFlag -> Bool Source #

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

isInferredForAllTyFlag :: ForAllTyFlag -> Bool Source #

# FunTyFlag

data FunTyFlag Source #

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 Source # |

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 Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c FunTyFlag Source #

toConstr :: FunTyFlag -> Constr Source #

dataTypeOf :: FunTyFlag -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c FunTyFlag) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FunTyFlag) Source #

gmapT :: (forall b. Data b => b -> b) -> FunTyFlag -> FunTyFlag Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FunTyFlag -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FunTyFlag -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> FunTyFlag -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> FunTyFlag -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> FunTyFlag -> m FunTyFlag Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> FunTyFlag -> m FunTyFlag Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> FunTyFlag -> m FunTyFlag Source #

Binary FunTyFlag Source # |
Instance details Defined in GHC.Types.Var Methods put_ :: BinHandle -> FunTyFlag -> IO () Source # put :: BinHandle -> FunTyFlag -> IO (Bin FunTyFlag) Source # get :: BinHandle -> IO FunTyFlag Source #
Outputable FunTyFlag Source # |
Instance details Defined in GHC.Types.Var Methods ppr :: FunTyFlag -> SDoc Source #
Eq FunTyFlag Source # |
Instance details Defined in GHC.Types.Var Methods (==) :: FunTyFlag -> FunTyFlag -> Bool # (/=) :: FunTyFlag -> FunTyFlag -> Bool #
Ord FunTyFlag Source # |
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 Source #

isInvisibleFunArg :: FunTyFlag -> Bool Source #

isFUNArg :: FunTyFlag -> Bool Source #

mkFunTyFlag :: TypeOrConstraint -> TypeOrConstraint -> FunTyFlag Source #

visArg :: TypeOrConstraint -> FunTyFlag Source #

invisArg :: TypeOrConstraint -> FunTyFlag Source #

visArgTypeLike :: FunTyFlag Source #

visArgConstraintLike :: FunTyFlag Source #

invisArgTypeLike :: FunTyFlag Source #

invisArgConstraintLike :: FunTyFlag Source #

funTyFlagResultTypeOrConstraint :: FunTyFlag -> TypeOrConstraint Source #

data TypeOrConstraint Source #

Constructors

TypeLike |
ConstraintLike |

#### Instances

Instances details

Data TypeOrConstraint Source # |

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 Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TypeOrConstraint Source #

toConstr :: TypeOrConstraint -> Constr Source #

dataTypeOf :: TypeOrConstraint -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TypeOrConstraint) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeOrConstraint) Source #

gmapT :: (forall b. Data b => b -> b) -> TypeOrConstraint -> TypeOrConstraint Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TypeOrConstraint -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TypeOrConstraint -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> TypeOrConstraint -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> TypeOrConstraint -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> TypeOrConstraint -> m TypeOrConstraint Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TypeOrConstraint -> m TypeOrConstraint Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TypeOrConstraint -> m TypeOrConstraint Source #

Eq TypeOrConstraint Source # |
Instance details Defined in GHC.Types.Basic Methods (==) :: TypeOrConstraint -> TypeOrConstraint -> Bool # (/=) :: TypeOrConstraint -> TypeOrConstraint -> Bool #
Ord TypeOrConstraint Source # |

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 Source #

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 Source # |

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 Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c PiTyBinder Source #

toConstr :: PiTyBinder -> Constr Source #

dataTypeOf :: PiTyBinder -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c PiTyBinder) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PiTyBinder) Source #

gmapT :: (forall b. Data b => b -> b) -> PiTyBinder -> PiTyBinder Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PiTyBinder -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PiTyBinder -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> PiTyBinder -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> PiTyBinder -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> PiTyBinder -> m PiTyBinder Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PiTyBinder -> m PiTyBinder Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PiTyBinder -> m PiTyBinder Source #

Outputable PiTyBinder Source # |
Instance details Defined in GHC.Types.Var Methods ppr :: PiTyBinder -> SDoc Source #

type PiTyVarBinder = PiTyBinder Source #

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

isInvisiblePiTyBinder :: PiTyBinder -> Bool Source #

Does this binder bind an invisible argument?

isVisiblePiTyBinder :: PiTyBinder -> Bool Source #

Does this binder bind a visible argument?

isTyBinder :: PiTyBinder -> Bool Source #

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 Source #

isAnonPiTyBinder :: PiTyBinder -> Bool Source #

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

namedPiTyBinder_maybe :: PiTyBinder -> Maybe TyCoVar Source #

anonPiTyBinderType_maybe :: PiTyBinder -> Maybe Type Source #

Extract a relevant type, if there is one.

piTyBinderType :: PiTyBinder -> Type Source #

# TyVar's

data VarBndr var argf Source #

Constructors

Bndr var argf |

#### Instances

Instances details

(Data var, Data argf) => Data (VarBndr var argf) Source # |

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) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (VarBndr var argf) Source #

toConstr :: VarBndr var argf -> Constr Source #

dataTypeOf :: VarBndr var argf -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (VarBndr var argf)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (VarBndr var argf)) Source #

gmapT :: (forall b. Data b => b -> b) -> VarBndr var argf -> VarBndr var argf Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> VarBndr var argf -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> VarBndr var argf -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> VarBndr var argf -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> VarBndr var argf -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> VarBndr var argf -> m (VarBndr var argf) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> VarBndr var argf -> m (VarBndr var argf) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> VarBndr var argf -> m (VarBndr var argf) Source #

NamedThing tv => NamedThing (VarBndr tv flag) Source # |
Instance details Defined in GHC.Types.Var Methods getOccName :: VarBndr tv flag -> OccName Source # getName :: VarBndr tv flag -> Name Source #
(Binary tv, Binary vis) => Binary (VarBndr tv vis) Source # |
Instance details Defined in GHC.Types.Var Methods put_ :: BinHandle -> VarBndr tv vis -> IO () Source # put :: BinHandle -> VarBndr tv vis -> IO (Bin (VarBndr tv vis)) Source # get :: BinHandle -> IO (VarBndr tv vis) Source #
OutputableBndr tv => Outputable (VarBndr tv TyConBndrVis) Source # |
Instance details Defined in GHC.Core.TyCon Methods ppr :: VarBndr tv TyConBndrVis -> SDoc Source #
Outputable tv => Outputable (VarBndr tv ForAllTyFlag) Source # |
Instance details Defined in GHC.Types.Var Methods ppr :: VarBndr tv ForAllTyFlag -> SDoc Source #
Outputable tv => Outputable (VarBndr tv Specificity) Source # |
Instance details Defined in GHC.Types.Var Methods ppr :: VarBndr tv Specificity -> SDoc Source #

type ForAllTyBinder = VarBndr TyCoVar ForAllTyFlag Source #

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 Source #

type InvisTyBinder = VarBndr TyCoVar Specificity Source #

type InvisTVBinder = VarBndr TyVar Specificity Source #

type ReqTyBinder = VarBndr TyCoVar () Source #

type ReqTVBinder = VarBndr TyVar () Source #

binderVar :: VarBndr tv argf -> tv Source #

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

binderFlag :: VarBndr tv argf -> argf Source #

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

binderType :: VarBndr TyCoVar argf -> Type Source #

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

Make a named binder

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

Make many named binders

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

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

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

Make many named binders Input vars should be type variables

isTyVarBinder :: VarBndr TyCoVar vis -> Bool Source #

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

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

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

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

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

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

## Constructing TyVar's

mkTyVar :: Name -> Kind -> TyVar Source #

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

## Taking `Var`s apart

tyVarName :: TyVar -> Name Source #

tyVarKind :: TyVar -> Kind Source #

tcTyVarDetails :: TyVar -> TcTyVarDetails Source #

setTcTyVarDetails :: TyVar -> TcTyVarDetails -> TyVar Source #

## Modifying `Var`s

setTyVarName :: TyVar -> Name -> TyVar Source #

setTyVarUnique :: TyVar -> Unique -> TyVar Source #

setTyVarKind :: TyVar -> Kind -> TyVar Source #

updateTyVarKind :: (Kind -> Kind) -> TyVar -> TyVar Source #

updateTyVarKindM :: Monad m => (Kind -> m Kind) -> TyVar -> m TyVar Source #

nonDetCmpVar :: Var -> Var -> Ordering Source #

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]