ghcjs / ghcjs-base

base library for GHCJS for JavaScript interaction and marshalling, used by higher level libraries like JSC
MIT License
45 stars 67 forks source link

How to use Export inside a Callback #105

Open louispan opened 6 years ago

louispan commented 6 years ago

Should Export constructor be exported? How do I convert a JSVal into an Export?

I'm trying to export a haskell value so that it can be called from javascript (in a callback). Therefore the callback should have the signature Callback (Export a -> IO JSVal). The closest match is callback1 :: Callback (JSVal -> IO JSVal)which means I need a way to convert JSVal to Export.

Unless there is an alternative way to do this?