GHCJS: How do I import a high order javascript function using FFI?
Thanks to the guys on the GHCJS IRC Channel I got the answer:
foreign import javascript safe "$1.subscribe($2)" rx_subscribe :: Observable a -> JSFun (a -> IO()) -> IO Disposablesubscribe :: FromJSRef a => (a -> IO()) -> Observable a -> IO Disposablesubscribe f xs = syncCallback1 True True f' >>= rx_subscribe xs where f' x = fromJSRef x >>= f . fromJust
Thank You