The `schedule` function in the run-time system is getting too big to modify.
In order to support GHC's existing run-time system operating in a WebAssembly machine under JavaScript, we will have to extend the scheduler with the ability to "suspend Haskell." This event will enable GHC to respect JavaScript's concurrency module: it will tell the scheduler that Haskell needs to yield the CPU by returning back to JavaScript. But as @bgamari writes,
schedule
is already a very large function with loops, gotos, mutability, and quite complex control flow. I would be reluctant to add to this complexity without first carrying out some simplification.
Function schedule
needs to be simplified.