问题
i want to execute some effectful computation on a regular basis in a program compiled with GHCJS, but GHCJS.DOM.WindowTimers.setInterval
wants a JSVal
as parameter. Could anybody give me some pointers for turning my IO ()
into a JSVal
?
Edit:
I was able to match the types using GHCJS.Foreign.Callback.asyncCallback
and GHCJS.Types.jsval
, but i have eventually got a runtime error. Luite in the GHCJS channel suggested to use threads for this task, as Erik suggested in a comment here. This is explained in the corresponding question
来源:https://stackoverflow.com/questions/33576618/how-to-convert-an-io-to-jsval-in-ghcjs