Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

How to get result of promise/async function without a continuation Haskell function. #116

Open
rowanG077 opened this issue Jun 26, 2020 · 0 comments

Comments

@rowanG077
Copy link

I have started using Miso with GHCJS and I want to use the web usb API to talk to some local embedded device. I can do this fine by creating foreign functions in GHCJS with something like this:

foreign import javascript interruptible
  "navigator.usb.requestDevice({ filters: [ $1 ]}).then($c);"
  jsRequestUSBDeviceAccess :: JsObj.Object -> IO JsObj.Object

Now I can simply call the function in Haskell like this:

usbDev <- jsRequestUSBDeviceAccess filters

Since I want to move to jsaddle I want to know how I can essentially rewrite this structure to be compatible with jsaddle. I in particular don't want two function where the second function is a continuation.

@rowanG077 rowanG077 changed the title How to get result of promise/async function without going calling another function on the haskell side. How to get result of promise/async function without a continuation Haskell function. Jun 26, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant