ghc-lib-parser-9.12.2.20250421: The GHC API, decoupled from GHC versions

Safe Haskell | Ignore
Language | GHC2021

GHC.Tc.Zonk.Monad

Contents

- The `ZonkM` monad, a stripped down `TcM` for zonking
  - Logging within `ZonkM`

Description

The `ZonkM` monad, a stripped down `TcM`, used when zonking within the typechecker in GHC.Tc.Zonk.TcType.

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

Synopsis

- data ZonkM a where
  - pattern ZonkM :: (ZonkGblEnv -> IO a) -> ZonkM a
- data ZonkGblEnv = ZonkGblEnv {
  - zge_logger :: Logger
  - zge_name_ppr_ctx :: NamePprCtx
  - zge_src_span :: SrcSpan
  - zge_tc_level :: TcLevel
  - zge_binder_stack :: TcBinderStack
  }
- getZonkGblEnv :: ZonkM ZonkGblEnv
- getZonkTcLevel :: ZonkM TcLevel
- traceZonk :: String -> SDoc -> ZonkM ()

# The `ZonkM` monad, a stripped down `TcM` for zonking

data ZonkM a where Source #

A stripped down version of `TcM` which is sufficient for zonking types.

Bundled Patterns

pattern ZonkM :: (ZonkGblEnv -> IO a) -> ZonkM a |

#### Instances

Instances details

MonadIO ZonkM Source # |
Instance details Defined in GHC.Tc.Zonk.Monad Methods liftIO :: IO a -> ZonkM a Source #
Applicative ZonkM Source # |
Instance details Defined in GHC.Tc.Zonk.Monad Methods pure :: a -> ZonkM a Source # (<*>) :: ZonkM (a -> b) -> ZonkM a -> ZonkM b Source # liftA2 :: (a -> b -> c) -> ZonkM a -> ZonkM b -> ZonkM c Source # (*>) :: ZonkM a -> ZonkM b -> ZonkM b Source # (<*) :: ZonkM a -> ZonkM b -> ZonkM a Source #
Functor ZonkM Source # |
Instance details Defined in GHC.Tc.Zonk.Monad Methods fmap :: (a -> b) -> ZonkM a -> ZonkM b Source # (<$) :: a -> ZonkM b -> ZonkM a Source #
Monad ZonkM Source # |
Instance details Defined in GHC.Tc.Zonk.Monad Methods (>>=) :: ZonkM a -> (a -> ZonkM b) -> ZonkM b Source # (>>) :: ZonkM a -> ZonkM b -> ZonkM b Source # return :: a -> ZonkM a Source #

data ZonkGblEnv Source #

Information needed by the `ZonkM` monad, which is a slimmed down version of `TcM` with just enough information for zonking.

Constructors

ZonkGblEnv |

Fields

- zge_logger :: Logger
- zge_name_ppr_ctx :: NamePprCtx
- zge_src_span :: SrcSpan
- zge_tc_level :: TcLevel
- zge_binder_stack :: TcBinderStack

getZonkGblEnv :: ZonkM ZonkGblEnv Source #

getZonkTcLevel :: ZonkM TcLevel Source #

## Logging within `ZonkM`

traceZonk :: String -> SDoc -> ZonkM () Source #

Same as `traceTc`, but for the `ZonkM` monad.