How to execute an action periodically in a GHCJS program?
问题 Should one use setInterval via Javascript, or use some more idiomatic solution based on threads? 回答1: If you don't care about the motivation, just scroll to my best solution runPeriodicallyConstantDrift below. If you prefer a simpler solution with worse results, then see runPeriodicallySmallDrift . My answer is not GHCJS specific, and has not been tested on GHCJS, only GHC, but it illustrates problems with the OP's naive solution. First Strawman Solution: runPeriodicallyBigDrift Here's my