Restructure the zonker
This MR refactors and splits up the zonker into a few separate components, described
in Note [The structure of the zonker] in GHC.Tc.Zonk.Type
.
-
GHC.Tc.Zonk.Monad
introduces a pared-downTcM
monad,ZonkM
, which has enough information for zonking types.
This allows us to refactorErrCtxt
to useZonkM
instead ofTcM
, which guarantees we don't throw an error while reporting an error. -
GHC.Tc.Zonk.Env
is the new home ofZonkEnv
, and also defines two zonking monad transformers,ZonkT
andZonkBndrT
.
ZonkT
is a reader monad transformer overZonkEnv
.
ZonkBndrT m
is the codensity monad overZonkT m
.ZonkBndrT
is used for computations that accumulate binders in theZonkEnv
. -
GHC.Tc.Zonk.TcType
contains the code for zonking types, for use in the typechecker. It uses theZonkM
monad. -
GHC.Tc.Zonk.Type
contains the code for final zonking toType
, which has been refactored to useZonkTcM = ZonkT TcM
andZonkBndrTcM = ZonkBndrT TcM
.