ghc-9.10.3: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.Tc.Zonk.TcType

Contents

- Zonking (within the typechecker)
  - The `ZonkM` monad and `ZonkGblEnv`
  - Zonking types
  - Zonking `TyCon`s
    - FreeVars
  - Zonking `CoVar`s and `Id`s
  - Zonking skolem info
  - Zonking constraints
- Tidying
  - Zonk & tidy
- Writing to metavariables
- Handling coercion holes

Description

Zonking types within the typechecker.

Distinct from the final zonking pass in GHC.Tc.Zonk.Type; see Note [Module structure for zonking] in GHC.Tc.Zonk.Type.

Synopsis

- module GHC.Tc.Zonk.Monad
- zonkTcType :: TcType -> ZonkM TcType
- zonkTcTypes :: [TcType] -> ZonkM [TcType]
- zonkTcTyVar :: TcTyVar -> ZonkM TcType
- zonkTcTyVars :: [TcTyVar] -> ZonkM [TcType]
- zonkTcTyVarToTcTyVar :: HasDebugCallStack => TcTyVar -> ZonkM TcTyVar
- zonkTcTyVarsToTcTyVars :: HasDebugCallStack => [TcTyVar] -> ZonkM [TcTyVar]
- zonkInvisTVBinder :: VarBndr TcTyVar spec -> ZonkM (VarBndr TcTyVar spec)
- zonkCo :: Coercion -> ZonkM Coercion
- zonkTcTyCon :: TcTyCon -> ZonkM TcTyCon
- zonkTcTypeAndFV :: TcType -> ZonkM DTyCoVarSet
- zonkTyCoVarsAndFV :: TyCoVarSet -> ZonkM TyCoVarSet
- zonkTyCoVarsAndFVList :: [TyCoVar] -> ZonkM [TyCoVar]
- zonkDTyCoVarSetAndFV :: DTyCoVarSet -> ZonkM DTyCoVarSet
- zonkId :: TcId -> ZonkM TcId
- zonkCoVar :: CoVar -> ZonkM CoVar
- zonkTyCoVar :: TyCoVar -> ZonkM TcType
- zonkTyCoVarKind :: TyCoVar -> ZonkM TyCoVar
- zonkTyCoVarBndrKind :: VarBndr TyCoVar flag -> ZonkM (VarBndr TyCoVar flag)
- zonkSkolemInfo :: SkolemInfo -> ZonkM SkolemInfo
- zonkSkolemInfoAnon :: SkolemInfoAnon -> ZonkM SkolemInfoAnon
- zonkCt :: Ct -> ZonkM Ct
- zonkWC :: WantedConstraints -> ZonkM WantedConstraints
- zonkSimples :: Cts -> ZonkM Cts
- zonkImplication :: Implication -> ZonkM Implication
- tcInitTidyEnv :: ZonkM TidyEnv
- tcInitOpenTidyEnv :: [TyCoVar] -> ZonkM TidyEnv
- tidyCt :: TidyEnv -> Ct -> Ct
- tidyEvVar :: TidyEnv -> EvVar -> EvVar
- tidyDelayedError :: TidyEnv -> DelayedError -> DelayedError
- zonkTidyTcType :: TidyEnv -> TcType -> ZonkM (TidyEnv, TcType)
- zonkTidyTcTypes :: TidyEnv -> [TcType] -> ZonkM (TidyEnv, [TcType])
- zonkTidyOrigin :: TidyEnv -> CtOrigin -> ZonkM (TidyEnv, CtOrigin)
- zonkTidyOrigins :: TidyEnv -> [CtOrigin] -> ZonkM (TidyEnv, [CtOrigin])
- zonkTidyFRRInfos :: TidyEnv -> [FixedRuntimeRepErrorInfo] -> ZonkM (TidyEnv, [FixedRuntimeRepErrorInfo])
- writeMetaTyVar :: HasDebugCallStack => TcTyVar -> TcType -> ZonkM ()
- writeMetaTyVarRef :: HasDebugCallStack => TcTyVar -> TcRef MetaDetails -> TcType -> ZonkM ()
- checkCoercionHole :: CoVar -> Coercion -> ZonkM Coercion

# Zonking (within the typechecker)

## The `ZonkM` monad and `ZonkGblEnv`

module GHC.Tc.Zonk.Monad

## Zonking types

zonkTcType :: TcType -> ZonkM TcType Source #

zonkTcTypes :: [TcType] -> ZonkM [TcType] Source #

zonkTcTyVar :: TcTyVar -> ZonkM TcType Source #

zonkTcTyVars :: [TcTyVar] -> ZonkM [TcType] Source #

zonkTcTyVarToTcTyVar :: HasDebugCallStack => TcTyVar -> ZonkM TcTyVar Source #

zonkTcTyVarsToTcTyVars :: HasDebugCallStack => [TcTyVar] -> ZonkM [TcTyVar] Source #

zonkInvisTVBinder :: VarBndr TcTyVar spec -> ZonkM (VarBndr TcTyVar spec) Source #

zonkCo :: Coercion -> ZonkM Coercion Source #

## Zonking `TyCon`s

zonkTcTyCon :: TcTyCon -> ZonkM TcTyCon Source #

### FreeVars

zonkTcTypeAndFV :: TcType -> ZonkM DTyCoVarSet Source #

zonkTyCoVarsAndFV :: TyCoVarSet -> ZonkM TyCoVarSet Source #

zonkTyCoVarsAndFVList :: [TyCoVar] -> ZonkM [TyCoVar] Source #

zonkDTyCoVarSetAndFV :: DTyCoVarSet -> ZonkM DTyCoVarSet Source #

## Zonking `CoVar`s and `Id`s

zonkId :: TcId -> ZonkM TcId Source #

zonkId is used *during* typechecking just to zonk the `Id'`s type

zonkCoVar :: CoVar -> ZonkM CoVar Source #

zonkTyCoVar :: TyCoVar -> ZonkM TcType Source #

zonkTyCoVarKind :: TyCoVar -> ZonkM TyCoVar Source #

zonkTyCoVarBndrKind :: VarBndr TyCoVar flag -> ZonkM (VarBndr TyCoVar flag) Source #

## Zonking skolem info

zonkSkolemInfo :: SkolemInfo -> ZonkM SkolemInfo Source #

zonkSkolemInfoAnon :: SkolemInfoAnon -> ZonkM SkolemInfoAnon Source #

## Zonking constraints

zonkCt :: Ct -> ZonkM Ct Source #

zonkWC :: WantedConstraints -> ZonkM WantedConstraints Source #

zonkSimples :: Cts -> ZonkM Cts Source #

zonkImplication :: Implication -> ZonkM Implication Source #

# Tidying

tcInitTidyEnv :: ZonkM TidyEnv Source #

tcInitOpenTidyEnv :: [TyCoVar] -> ZonkM TidyEnv Source #

Get a `TidyEnv` that includes mappings for all vars free in the given type. Useful when tidying open types.

tidyCt :: TidyEnv -> Ct -> Ct Source #

tidyEvVar :: TidyEnv -> EvVar -> EvVar Source #

tidyDelayedError :: TidyEnv -> DelayedError -> DelayedError Source #

## Zonk & tidy

zonkTidyTcType :: TidyEnv -> TcType -> ZonkM (TidyEnv, TcType) Source #

zonkTidyTcTypes :: TidyEnv -> [TcType] -> ZonkM (TidyEnv, [TcType]) Source #

zonkTidyOrigin :: TidyEnv -> CtOrigin -> ZonkM (TidyEnv, CtOrigin) Source #

zonkTidyOrigins :: TidyEnv -> [CtOrigin] -> ZonkM (TidyEnv, [CtOrigin]) Source #

zonkTidyFRRInfos :: TidyEnv -> [FixedRuntimeRepErrorInfo] -> ZonkM (TidyEnv, [FixedRuntimeRepErrorInfo]) Source #

# Writing to metavariables

writeMetaTyVar Source #

Arguments

:: HasDebugCallStack |
=> TcTyVar | the type varfiable to write to
-> TcType | the type to write into the mutable reference
-> ZonkM () |

Write into a currently-empty MetaTyVar.

Works with both type and kind variables.

writeMetaTyVarRef Source #

Arguments

:: HasDebugCallStack |
=> TcTyVar | for debug assertions only;
-> TcRef MetaDetails | ref cell must be for the same tyvar
-> TcType | the type to write to the mutable reference
-> ZonkM () |

Write into the `MetaDetails` mutable references of a `MetaTv`.

# Handling coercion holes

checkCoercionHole :: CoVar -> Coercion -> ZonkM Coercion Source #

Check that a coercion is appropriate for filling a hole. (The hole itself is needed only for printing.) Always returns the checked coercion, but this return value is necessary so that the input coercion is forced only when the output is forced.