Var

ghc-8.10.7: The GHC API

Safe Haskell | None
Language | Haskell2010

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
- ArgFlags
- TyVar's
  - Constructing TyVar's
  - Taking `TyVar`s apart
  - Modifying `TyVar`s

Description

GHC uses several kinds of name internally:

- `OccName`: see OccName
- `RdrName`: see RdrName
- `Name`: see Name
- `Id`: see 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 Var

Global `Id`s and `Var`s are those that are imported or correspond to a data constructor, primitive operation, or record selectors. Local `Id`s and `Var`s are those bound within an expression (e.g. by a lambda) or at the top level of the module being compiled.

Synopsis

- data Var
- type CoVar = Id
- type Id = Var
- type NcId = Id
- type DictId = EvId
- type DFunId = Id
- type EvVar = EvId
- type EqVar = EvId
- type EvId = Id
- type IpId = EvId
- type JoinId = Id
- type TyVar = Var
- type TcTyVar = Var
- type TypeVar = Var
- type KindVar = Var
- type TKVar = Var
- type TyCoVar = Id
- type InVar = Var
- type InCoVar = CoVar
- type InId = Id
- type InTyVar = TyVar
- type OutVar = Var
- type OutCoVar = CoVar
- type OutId = Id
- type OutTyVar = TyVar
- varName :: Var -> Name
- varUnique :: Var -> Unique
- varType :: Var -> Kind
- setVarName :: Var -> Name -> Var
- setVarUnique :: Var -> Unique -> Var
- setVarType :: Id -> Type -> Id
- updateVarType :: (Type -> Type) -> Id -> Id
- updateVarTypeM :: Monad m => (Type -> m Type) -> Id -> m Id
- mkGlobalVar :: IdDetails -> Name -> Type -> IdInfo -> Id
- mkLocalVar :: IdDetails -> Name -> Type -> IdInfo -> Id
- mkExportedLocalVar :: IdDetails -> Name -> Type -> IdInfo -> Id
- mkCoVar :: Name -> Type -> CoVar
- idInfo :: HasDebugCallStack => Id -> IdInfo
- idDetails :: Id -> IdDetails
- lazySetIdInfo :: Id -> IdInfo -> Var
- setIdDetails :: Id -> IdDetails -> Id
- globaliseId :: Id -> Id
- setIdExported :: Id -> Id
- setIdNotExported :: Id -> Id
- isId :: Var -> Bool
- isTyVar :: Var -> Bool
- isTcTyVar :: Var -> Bool
- isLocalVar :: Var -> Bool
- isLocalId :: Var -> Bool
- isCoVar :: Var -> Bool
- isNonCoVarId :: Var -> Bool
- isTyCoVar :: Var -> Bool
- isGlobalId :: Var -> Bool
- isExportedId :: Var -> Bool
- mustHaveLocalBinding :: Var -> Bool
- data ArgFlag
  - = Inferred
  - | Specified
  - | Required
- isVisibleArgFlag :: ArgFlag -> Bool
- isInvisibleArgFlag :: ArgFlag -> Bool
- sameVis :: ArgFlag -> ArgFlag -> Bool
- data AnonArgFlag
  - = VisArg
  - | InvisArg
- data ForallVisFlag
  - = ForallVis
  - | ForallInvis
- argToForallVisFlag :: ArgFlag -> ForallVisFlag
- data VarBndr var argf = Bndr var argf
- type TyCoVarBinder = VarBndr TyCoVar ArgFlag
- type TyVarBinder = VarBndr TyVar ArgFlag
- binderVar :: VarBndr tv argf -> tv
- binderVars :: [VarBndr tv argf] -> [tv]
- binderArgFlag :: VarBndr tv argf -> argf
- binderType :: VarBndr TyCoVar argf -> Type
- mkTyCoVarBinder :: ArgFlag -> TyCoVar -> TyCoVarBinder
- mkTyCoVarBinders :: ArgFlag -> [TyCoVar] -> [TyCoVarBinder]
- mkTyVarBinder :: ArgFlag -> TyVar -> TyVarBinder
- mkTyVarBinders :: ArgFlag -> [TyVar] -> [TyVarBinder]
- isTyVarBinder :: TyCoVarBinder -> Bool
- mkTyVar :: Name -> Kind -> TyVar
- mkTcTyVar :: Name -> Kind -> TcTyVarDetails -> TyVar
- tyVarName :: TyVar -> Name
- tyVarKind :: TyVar -> Kind
- tcTyVarDetails :: TyVar -> TcTyVarDetails
- setTcTyVarDetails :: TyVar -> TcTyVarDetails -> TyVar
- setTyVarName :: TyVar -> Name -> TyVar
- setTyVarUnique :: TyVar -> Unique -> TyVar
- setTyVarKind :: TyVar -> Kind -> TyVar
- updateTyVarKind :: (Kind -> Kind) -> TyVar -> TyVar
- updateTyVarKindM :: Monad m => (Kind -> m Kind) -> TyVar -> m TyVar
- nonDetCmpVar :: Var -> Var -> Ordering

# The main data type and synonyms

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

Eq Var # |
Instance details Defined in Var Methods (==) :: Var -> Var -> Bool # (/=) :: Var -> Var -> Bool #
Data Var # |
Instance details Defined in 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 #
Ord Var # |
Instance details Defined in 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 #
OutputableBndr Var # |
Instance details Defined in PprCore Methods pprBndr :: BindingSite -> Var -> SDoc Source # pprPrefixOcc :: Var -> SDoc Source # pprInfixOcc :: Var -> SDoc Source # bndrIsJoin_maybe :: Var -> Maybe Int Source #
Outputable Var # |
Instance details Defined in Var Methods ppr :: Var -> SDoc Source # pprPrec :: Rational -> Var -> SDoc Source #
Uniquable Var # |
Instance details Defined in Var Methods getUnique :: Var -> Unique Source #
HasOccName Var # |
Instance details Defined in Var Methods occName :: Var -> OccName Source #
NamedThing Var # |
Instance details Defined in Var Methods getOccName :: Var -> OccName Source # getName :: Var -> Name Source #

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

## Modifying `Var`s

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

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

setVarType :: Id -> Type -> Id Source #

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

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

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

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

mkLocalVar :: IdDetails -> Name -> 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

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

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

# ArgFlags

data ArgFlag Source #

Argument Flag

Is something required to appear in source Haskell (`Required`), permitted by request (`Specified`) (visible type application), or prohibited entirely from appearing in source Haskell (`Inferred`)? See Note [VarBndrs, TyCoVarBinders, TyConBinders, and visibility] in TyCoRep

Constructors

Inferred |
Specified |
Required |

#### Instances

Instances details

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

isVisibleArgFlag :: ArgFlag -> Bool Source #

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

isInvisibleArgFlag :: ArgFlag -> Bool Source #

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

sameVis :: ArgFlag -> ArgFlag -> Bool Source #

Do these denote the same level of visibility? `Required` arguments are visible, others are not. So this function equates `Specified` and `Inferred`. Used for printing.

data AnonArgFlag Source #

The non-dependent version of `ArgFlag`.

Constructors

VisArg | Used for `(->)`: an ordinary non-dependent arrow. The argument is visible in source code.
InvisArg | Used for `(=>)`: a non-dependent predicate arrow. The argument is invisible in source code.

#### Instances

Instances details

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

data ForallVisFlag Source #

Is a `forall` invisible (e.g., `forall a b. {...}`, with a dot) or visible (e.g., `forall a b -> {...}`, with an arrow)?

Constructors

ForallVis | A visible `forall` (with an arrow)
ForallInvis | An invisible `forall` (with a dot)

#### Instances

Instances details

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

argToForallVisFlag :: ArgFlag -> ForallVisFlag Source #

Convert an `ArgFlag` to its corresponding `ForallVisFlag`.

# TyVar's

data VarBndr var argf Source #

Constructors

Bndr var argf |

#### Instances

Instances details

(Data var, Data argf) => Data (VarBndr var argf) # |
Instance details Defined in 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 #
Outputable tv => Outputable (VarBndr tv ArgFlag) # |
Instance details Defined in Var Methods ppr :: VarBndr tv ArgFlag -> SDoc Source # pprPrec :: Rational -> VarBndr tv ArgFlag -> SDoc Source #
OutputableBndr tv => Outputable (VarBndr tv TyConBndrVis) # |
Instance details Defined in TyCon Methods ppr :: VarBndr tv TyConBndrVis -> SDoc Source # pprPrec :: Rational -> VarBndr tv TyConBndrVis -> SDoc Source #
(Binary tv, Binary vis) => Binary (VarBndr tv vis) # |
Instance details Defined in 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 #
NamedThing tv => NamedThing (VarBndr tv flag) # |
Instance details Defined in Var Methods getOccName :: VarBndr tv flag -> OccName Source # getName :: VarBndr tv flag -> Name Source #

type TyCoVarBinder = VarBndr TyCoVar ArgFlag Source #

Variable Binder

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

A `TyVarBinder` is a binder with only TyVar

type TyVarBinder = VarBndr TyVar ArgFlag Source #

binderVar :: VarBndr tv argf -> tv Source #

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

binderArgFlag :: VarBndr tv argf -> argf Source #

binderType :: VarBndr TyCoVar argf -> Type Source #

mkTyCoVarBinder :: ArgFlag -> TyCoVar -> TyCoVarBinder Source #

Make a named binder

mkTyCoVarBinders :: ArgFlag -> [TyCoVar] -> [TyCoVarBinder] Source #

Make many named binders

mkTyVarBinder :: ArgFlag -> TyVar -> TyVarBinder Source #

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

mkTyVarBinders :: ArgFlag -> [TyVar] -> [TyVarBinder] Source #

Make many named binders Input vars should be type variables

isTyVarBinder :: TyCoVarBinder -> Bool Source #

## Constructing TyVar's

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]