HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleghc-9.10.3GHC2021

GHC.JS.JStg.Monad

  • Domain and Purpose

    GHC.JS.JStg.Monad defines the computational environment for the eDSL that we use to write the JS Backend's RTS. Its purpose is to ensure unique identifiers are generated throughout the backend and that we can use the host language to ensure references are not mixed.

  • Strategy

    The monad is a straightforward state monad which holds an environment holds a pointer to a prefix to tag identifiers with and an infinite stream of identifiers.

  • Usage

    One should almost never need to directly use the functions in this module. Instead one should opt to use the combinators in GHC.JS.Make, the sole exception to this is the withTag function which is used to change the prefix of identifiers for a given computation. For example, the rts uses this function to tag all identifiers generated by the RTS code as RTS_N, where N is some unique.

  • 1 type
  • 4 values
  • Packageghc-9.10.3
  • Exports5
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceMonad.hs
valuewithTag
  1. :: FastString

    new name to tag with

  2. -> JSM a

    action to run with new tags

  3. -> JSM a

    result

#

tag the name generater with a prefix for the monadic action.