HORIZON HASKELLDocslts/ghc-10.0.x2b276322026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 2b27632 · 2026-10-31

Moduleghc-10.0.0.20260917GHC2024

GHC.Tc.Zonk.Env

The ZonkEnv zonking environment, and the ZonkT and ZonkBndrT monad transformers, for the final zonking to type in GHC.Tc.Zonk.Type.

See Note [Module structure for zonking] in GHC.Tc.Zonk.Type.

Contents
  1. The ZonkEnv
  2. The ZonkT and ZonkBndrT zonking monad transformers
  3. Going between ZonkT and ZonkBndrT
  4. Modifying and extending the ZonkEnv in ZonkBndrT
Synopsis
datadata ZonkFlexi

How should we handle unfilled unification variables in the zonker?

See Note [Un-unified unification variables]

Constructors

The ZonkT and ZonkBndrT zonking monad transformers

newtypenewtype ZonkT (m :: Type -> Type) a

A reader monad over ZonkEnv, for zonking computations which don't modify the ZonkEnv (e.g. don't bind any variables).

Use ZonkBndrT when you need to modify the ZonkEnv (e.g. to bind a variable).

Instances6MonadTrans, Monad, Functor, MonadFix, Applicative, MonadIO
newtypenewtype ZonkBndrT (m :: Type -> Type) a

Zonk binders, bringing them into scope in the inner computation.

Can be thought of as a state monad transformer StateT ZonkEnv m a, but written in continuation-passing style.

See Note [Continuation-passing style for zonking].

Constructors

Instances5Monad, Functor, MonadFix, Applicative, MonadIO

Going between ZonkT and ZonkBndrT

valuerunZonkBndrT :: ZonkBndrT m a -> forall r. (a -> ZonkT m r) -> ZonkT m r

Zonk some binders and run the continuation.

Example:

zonk (ForAllTy (Bndr tv vis) body_ty)
 = runZonkBndrT (zonkTyBndrX tv) $ \ tv' ->
   do { body_ty' <- zonkTcTypeToTypeX body_ty
      ; return (ForAllTy (Bndr tv' vis) body_ty') }

See Note [Continuation-passing style for zonking].

Modifying and extending the ZonkEnv in ZonkBndrT