HORIZON HASKELLDocslts/ghc-9.14.x6d5fdfd2026-10-12Search packagesCtrl K
Theme: |

GHC 9.14.1 · lts/ghc-9.14.x · 6d5fdfd · 2026-10-12

Moduleghc-9.14.1GHC2021

GHC.Tc.Utils.Monad

Functions for working with the typechecker environment (setters, getters...).

Contents
  1. Initialisation
  2. Simple accessors
  3. Arrow scopes
  4. Unique supply
  5. Accessing input/output
  6. Debugging
  7. Typechecker global environment
  8. Error management
  9. Usage environment
  10. Shared error message stuff: renamer and typechecker
  11. Context management for the type checker
  12. Diagnostic message generation (type checker)
  13. Type constraints
  14. Template Haskell context
  15. Safe Haskell context
  16. Stuff for the renamer's local env
  17. Stuff for interface decls
  18. Stuff for cost centres.
  19. Zonking
  20. Complete matches
  21. Types etc.
Synopsis
  • Packageghc-9.14.1
  • Exports228
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceMonad.hs

Initialisation

Simple accessors

Arrow scopes

Unique supply

Accessing input/output

Debugging

valuedumpTcRn :: Bool -> DumpFlag -> String -> DumpFormat -> SDoc -> TcRn ()

Unconditionally dump some trace output

Certain tests (T3017, Roles3, T12763 etc.) expect part of the output generated by `-ddump-types` to be in PprUser style. However, generally we want all other debugging output to use PprDump style. We PprUser style if useUserStyle is True.

Typechecker global environment

Error management

Usage environment

valuetcCollectingUsage :: TcM a -> TcM (UsageEnv, a)

tcCollectingUsage thing_inside runs thing_inside and returns the usage information which was collected as part of the execution of thing_inside. Careful: tcCollectingUsage thing_inside itself does not report any usage information, it's up to the caller to incorporate the returned usage information into the larger context appropriately.

Shared error message stuff: renamer and typechecker

valuemapAndRecoverM :: (a -> TcRn b) -> [a] -> TcRn [b]

Drop elements of the input that fail, so the result list can be shorter than the argument list

valuemapAndReportM :: (a -> TcRn b) -> [a] -> TcRn [b]

Apply the function to all elements on the input list If all succeed, return the list of results Otherwise fail, propagating all errors

Context management for the type checker

Add a fixed landmark message to the error context. A landmark message is always sure to be reported, even if there is a lot of context. It also doesn't count toward the maximum number of contexts reported.

Diagnostic message generation (type checker)

Type constraints

Template Haskell context

Safe Haskell context

Stuff for the renamer's local env

Stuff for interface decls

valueinitIfaceLoadModule :: HscEnv -> Module -> IfG a -> IO a

This is used when we are doing to call typecheckModule on an ModIface, if it's part of a loop with some other modules then we need to use their IORef TypeEnv vars when typechecking but crucially not our own.

valueforkM :: SDoc -> IfL a -> IfL a

Run thing_inside in an interleaved thread. It shares everything with the parent thread, so this is DANGEROUS.

It throws an error if the computation fails

It's used for lazily type-checking interface signatures, which is pretty benign.

See Note [Masking exceptions in forkM]

Stuff for cost centres.

Zonking

Complete matches

Types etc.

Orphan instances

1 instance