GHC.Tc.Zonk.Type

ghc-9.10.0.20240426: The GHC API

Safe Haskell | None
Language | GHC2021

GHC.Tc.Zonk.Type

Contents

- Zonking
  - `ZonkEnv`, and the `ZonkT` and `ZonkBndrT` monad transformers
- Coercion holes
- Rewriter sets
- Tidying

Description

Final zonking to `Type`. See Note [Zonking to Type].

Distinct from the intra-typechecker zonking in GHC.Tc.Zonk.TcType; see Note [Module structure for zonking].

Synopsis

- type ZonkTcM = ZonkT TcM
- zonkTopDecls :: Bag EvBind -> LHsBinds GhcTc -> [LRuleDecl GhcTc] -> [LTcSpecPrag] -> [LForeignDecl GhcTc] -> TcM (TypeEnv, Bag EvBind, LHsBinds GhcTc, [LForeignDecl GhcTc], [LTcSpecPrag], [LRuleDecl GhcTc])
- zonkTopExpr :: HsExpr GhcTc -> TcM (HsExpr GhcTc)
- zonkTopLExpr :: LHsExpr GhcTc -> TcM (LHsExpr GhcTc)
- zonkTopBndrs :: [TcId] -> TcM [Id]
- zonkTyVarBindersX :: [VarBndr TcTyVar vis] -> ZonkBndrTcM [VarBndr TyVar vis]
- zonkTyVarBinderX :: VarBndr TcTyVar vis -> ZonkBndrTcM (VarBndr TyVar vis)
- zonkTyBndrX :: TcTyVar -> ZonkBndrTcM TyVar
- zonkTyBndrsX :: [TcTyVar] -> ZonkBndrTcM [TcTyVar]
- zonkTcTypeToType :: TcType -> TcM Type
- zonkTcTypeToTypeX :: TcType -> ZonkTcM Type
- zonkTcTypesToTypesX :: [TcType] -> ZonkTcM [Type]
- zonkScaledTcTypesToTypesX :: [Scaled TcType] -> ZonkTcM [Scaled Type]
- zonkTyVarOcc :: HasDebugCallStack => TcTyVar -> ZonkTcM Type
- zonkCoToCo :: Coercion -> ZonkTcM Coercion
- zonkEvBinds :: Bag EvBind -> ZonkBndrTcM (Bag EvBind)
- zonkTcEvBinds :: TcEvBinds -> ZonkBndrTcM TcEvBinds
- zonkTcMethInfoToMethInfoX :: TcMethInfo -> ZonkTcM MethInfo
- lookupTyVarX :: TcTyVar -> ZonkTcM TyVar
- module GHC.Tc.Zonk.Env
- isFilledCoercionHole :: CoercionHole -> TcM Bool
- unpackCoercionHole :: CoercionHole -> TcM Coercion
- unpackCoercionHole_maybe :: CoercionHole -> TcM (Maybe Coercion)
- zonkRewriterSet :: RewriterSet -> TcM RewriterSet
- zonkCtRewriterSet :: Ct -> TcM Ct
- zonkCtEvRewriterSet :: CtEvidence -> TcM CtEvidence
- tcInitTidyEnv :: ZonkM TidyEnv
- tcInitOpenTidyEnv :: [TyCoVar] -> ZonkM TidyEnv

# Zonking

For a description of "zonking", see Note [What is zonking?].

type ZonkTcM = ZonkT TcM Source #

Zonking monad for a computation that zonks to Type, reading from a `ZonkEnv` but not extending or modifying it.

See Note [Zonking to Type].

zonkTopDecls :: Bag EvBind -> LHsBinds GhcTc -> [LRuleDecl GhcTc] -> [LTcSpecPrag] -> [LForeignDecl GhcTc] -> TcM (TypeEnv, Bag EvBind, LHsBinds GhcTc, [LForeignDecl GhcTc], [LTcSpecPrag], [LRuleDecl GhcTc]) Source #

zonkTopExpr :: HsExpr GhcTc -> TcM (HsExpr GhcTc) Source #

zonkTopLExpr :: LHsExpr GhcTc -> TcM (LHsExpr GhcTc) Source #

zonkTopBndrs :: [TcId] -> TcM [Id] Source #

zonkTyVarBindersX :: [VarBndr TcTyVar vis] -> ZonkBndrTcM [VarBndr TyVar vis] Source #

zonkTyVarBinderX :: VarBndr TcTyVar vis -> ZonkBndrTcM (VarBndr TyVar vis) Source #

zonkTyBndrX :: TcTyVar -> ZonkBndrTcM TyVar Source #

zonkTyBndrsX :: [TcTyVar] -> ZonkBndrTcM [TcTyVar] Source #

zonkTcTypeToType :: TcType -> TcM Type Source #

Confused by zonking? See Note [What is zonking?] in GHC.Tc.Zonk.Type.

zonkTcTypeToTypeX :: TcType -> ZonkTcM Type Source #

zonkTcTypesToTypesX :: [TcType] -> ZonkTcM [Type] Source #

zonkScaledTcTypesToTypesX :: [Scaled TcType] -> ZonkTcM [Scaled Type] Source #

zonkTyVarOcc :: HasDebugCallStack => TcTyVar -> ZonkTcM Type Source #

zonkCoToCo :: Coercion -> ZonkTcM Coercion Source #

zonkEvBinds :: Bag EvBind -> ZonkBndrTcM (Bag EvBind) Source #

zonkTcEvBinds :: TcEvBinds -> ZonkBndrTcM TcEvBinds Source #

zonkTcMethInfoToMethInfoX :: TcMethInfo -> ZonkTcM MethInfo Source #

lookupTyVarX :: TcTyVar -> ZonkTcM TyVar Source #

## `ZonkEnv`, and the `ZonkT` and `ZonkBndrT` monad transformers

module GHC.Tc.Zonk.Env

# Coercion holes

isFilledCoercionHole :: CoercionHole -> TcM Bool Source #

Is a coercion hole filled in?

unpackCoercionHole :: CoercionHole -> TcM Coercion Source #

Retrieve the contents of a coercion hole. Panics if the hole is unfilled

unpackCoercionHole_maybe :: CoercionHole -> TcM (Maybe Coercion) Source #

Retrieve the contents of a coercion hole, if it is filled

# Rewriter sets

zonkRewriterSet :: RewriterSet -> TcM RewriterSet Source #

Check whether any coercion hole in a RewriterSet is still unsolved. Does this by recursively looking through filled coercion holes until one is found that is not yet filled in, at which point this aborts.

zonkCtRewriterSet :: Ct -> TcM Ct Source #

zonkCtEvRewriterSet :: CtEvidence -> TcM CtEvidence 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.