Copyright | (c) The University of Glasgow 2001 |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Jeffrey Young <jeffrey.young@iohk.io> Luite Stegeman <luite.stegeman@iohk.io> Sylvain Henry <sylvain.henry@iohk.io> Josh Meredith <josh.meredith@iohk.io> |
Stability | experimental |
Safe Haskell | None |
Language | GHC2021 |
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
Make
, the sole exception to this is thewithTag
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.
Documentation
:: FastString | new name to tag with |
-> JSM a | action to run with new tags |
-> JSM a | result |
tag the name generater with a prefix for the monadic action.