How to convert an `IO ()` to `JSVal` in GHCJS

a 夏天 提交于 2019-12-10 15:23:20

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!