ghc-lib-parser-9.12.2.20250421: 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 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 -> JoinPointHood Source #
Eq Var Source # |
Instance details Defined in GHC.Types.Var Methods (==) :: Var -> Var -> Bool Source # (/=) :: Var -> Var -> Bool Source #
Ord Var Source # |
Instance details Defined in GHC.Types.Var Methods compare :: Var -> Var -> Ordering Source # (<) :: Var -> Var -> Bool Source # (<=) :: Var -> Var -> Bool Source # (>) :: Var -> Var -> Bool Source # (>=) :: Var -> Var -> Bool Source # max :: Var -> Var -> Var Source # min :: Var -> Var -> Var Source #
Eq (DeBruijn CoreAlt) Source # |
Instance details Defined in GHC.Core.Map.Expr Methods (==) :: DeBruijn CoreAlt -> DeBruijn CoreAlt -> Bool Source # (/=) :: DeBruijn CoreAlt -> DeBruijn CoreAlt -> Bool Source #
Eq (DeBruijn CoreExpr) Source # |
Instance details Defined in GHC.Core.Map.Expr Methods (==) :: DeBruijn CoreExpr -> DeBruijn CoreExpr -> Bool Source # (/=) :: DeBruijn CoreExpr -> DeBruijn CoreExpr -> Bool Source #
Eq (DeBruijn Var) Source # |
Instance details Defined in GHC.Core.Map.Type Methods (==) :: DeBruijn Var -> DeBruijn Var -> Bool Source # (/=) :: DeBruijn Var -> DeBruijn Var -> Bool Source #
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) -> JoinPointHood Source #
type Anno Id Source # |
Instance details Defined in GHC.Hs.Extension type Anno Id = SrcSpanAnnN

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

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 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 `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 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) `Id`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 `Id`s These are the variables that we need to pay attention to when finding free variables, or doing dependency analysis.

isLocalId :: Var -> Bool Source #

isLocalId_maybe :: Var -> Maybe ExportFlag 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 (`Id`) 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 `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 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

NFData ForAllTyFlag Source # |
Instance details Defined in GHC.Hs.Specificity Methods rnf :: ForAllTyFlag -> () Source #
Data ForAllTyFlag Source # |

Instance details

Defined in Language.Haskell.Syntax.Specificity

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.Hs.Specificity Methods put_ :: WriteBinHandle -> ForAllTyFlag -> IO () Source # put :: WriteBinHandle -> ForAllTyFlag -> IO (Bin ForAllTyFlag) Source # get :: ReadBinHandle -> IO ForAllTyFlag Source #
Outputable ForAllTyFlag Source # |
Instance details Defined in GHC.Hs.Specificity Methods ppr :: ForAllTyFlag -> SDoc Source #
Eq ForAllTyFlag Source # |
Instance details Defined in Language.Haskell.Syntax.Specificity Methods (==) :: ForAllTyFlag -> ForAllTyFlag -> Bool Source # (/=) :: ForAllTyFlag -> ForAllTyFlag -> Bool Source #
Ord ForAllTyFlag Source # |

Instance details

Defined in Language.Haskell.Syntax.Specificity

Methods

compare :: ForAllTyFlag -> ForAllTyFlag -> Ordering Source #

(<) :: ForAllTyFlag -> ForAllTyFlag -> Bool Source #

(<=) :: ForAllTyFlag -> ForAllTyFlag -> Bool Source #

(>) :: ForAllTyFlag -> ForAllTyFlag -> Bool Source #

(>=) :: ForAllTyFlag -> ForAllTyFlag -> Bool Source #

max :: ForAllTyFlag -> ForAllTyFlag -> ForAllTyFlag Source #

min :: ForAllTyFlag -> ForAllTyFlag -> ForAllTyFlag Source #

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

NFData Specificity Source # |
Instance details Defined in GHC.Hs.Specificity Methods rnf :: Specificity -> () Source #
Data Specificity Source # |

Instance details

Defined in Language.Haskell.Syntax.Specificity

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.Hs.Specificity Methods put_ :: WriteBinHandle -> Specificity -> IO () Source # put :: WriteBinHandle -> Specificity -> IO (Bin Specificity) Source # get :: ReadBinHandle -> IO Specificity Source #
Eq Specificity Source # |
Instance details Defined in Language.Haskell.Syntax.Specificity Methods (==) :: Specificity -> Specificity -> Bool Source # (/=) :: Specificity -> Specificity -> Bool Source #
Ord Specificity Source # |

Instance details

Defined in Language.Haskell.Syntax.Specificity

Methods

compare :: Specificity -> Specificity -> Ordering Source #

(<) :: Specificity -> Specificity -> Bool Source #

(<=) :: Specificity -> Specificity -> Bool Source #

(>) :: Specificity -> Specificity -> Bool Source #

(>=) :: Specificity -> Specificity -> Bool Source #

max :: Specificity -> Specificity -> Specificity Source #

min :: Specificity -> Specificity -> Specificity Source #

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 #

isSpecifiedForAllTyFlag :: ForAllTyFlag -> Bool Source #

coreTyLamForAllTyFlag :: ForAllTyFlag Source #

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

# 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_ :: WriteBinHandle -> FunTyFlag -> IO () Source # put :: WriteBinHandle -> FunTyFlag -> IO (Bin FunTyFlag) Source # get :: ReadBinHandle -> 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 Source # (/=) :: FunTyFlag -> FunTyFlag -> Bool Source #
Ord FunTyFlag Source # |
Instance details Defined in GHC.Types.Var Methods compare :: FunTyFlag -> FunTyFlag -> Ordering Source # (<) :: FunTyFlag -> FunTyFlag -> Bool Source # (<=) :: FunTyFlag -> FunTyFlag -> Bool Source # (>) :: FunTyFlag -> FunTyFlag -> Bool Source # (>=) :: FunTyFlag -> FunTyFlag -> Bool Source # max :: FunTyFlag -> FunTyFlag -> FunTyFlag Source # min :: FunTyFlag -> FunTyFlag -> FunTyFlag Source #

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 #

funTyFlagArgTypeOrConstraint :: FunTyFlag -> TypeOrConstraint 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 Source # (/=) :: TypeOrConstraint -> TypeOrConstraint -> Bool Source #
Ord TypeOrConstraint Source # |

Instance details

Defined in GHC.Types.Basic

Methods

compare :: TypeOrConstraint -> TypeOrConstraint -> Ordering Source #

(<) :: TypeOrConstraint -> TypeOrConstraint -> Bool Source #

(<=) :: TypeOrConstraint -> TypeOrConstraint -> Bool Source #

(>) :: TypeOrConstraint -> TypeOrConstraint -> Bool Source #

(>=) :: TypeOrConstraint -> TypeOrConstraint -> Bool Source #

max :: TypeOrConstraint -> TypeOrConstraint -> TypeOrConstraint Source #

min :: TypeOrConstraint -> TypeOrConstraint -> TypeOrConstraint Source #

# 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 `TyVar` 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_ :: WriteBinHandle -> VarBndr tv vis -> IO () Source # put :: WriteBinHandle -> VarBndr tv vis -> IO (Bin (VarBndr tv vis)) Source # get :: ReadBinHandle -> 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 #
(Eq var, Eq argf) => Eq (VarBndr var argf) Source # |
Instance details Defined in GHC.Types.Var Methods (==) :: VarBndr var argf -> VarBndr var argf -> Bool Source # (/=) :: VarBndr var argf -> VarBndr var argf -> Bool Source #
(Ord var, Ord argf) => Ord (VarBndr var argf) Source # |

Instance details

Defined in GHC.Types.Var

Methods

compare :: VarBndr var argf -> VarBndr var argf -> Ordering Source #

(<) :: VarBndr var argf -> VarBndr var argf -> Bool Source #

(<=) :: VarBndr var argf -> VarBndr var argf -> Bool Source #

(>) :: VarBndr var argf -> VarBndr var argf -> Bool Source #

(>=) :: VarBndr var argf -> VarBndr var argf -> Bool Source #

max :: VarBndr var argf -> VarBndr var argf -> VarBndr var argf Source #

min :: VarBndr var argf -> VarBndr var argf -> VarBndr var argf 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

isVisibleForAllTyBinder :: ForAllTyBinder -> Bool Source #

isInvisibleForAllTyBinder :: ForAllTyBinder -> Bool Source #

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 #

## ExportFlag

data ExportFlag Source #

Constructors

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

## Constructing TyVar's

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

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

## Taking `TyVar`s apart

tyVarName :: TyVar -> Name Source #

tyVarKind :: TyVar -> Kind Source #

tcTyVarDetails :: TyVar -> TcTyVarDetails Source #

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

## Modifying `TyVar`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]