Skip to content

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

Open
@rowanG077

Description

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.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions