ghcjs / ghcjs-dom

Make Document Object Model (DOM) apps that run in any browser and natively using WebKitGtk
74 stars 41 forks source link

Use new JS backend syntax in js_send foreign import #105

Closed sevanspowell closed 6 months ago

sevanspowell commented 6 months ago

I believe that some foreign imports haven't been updated to use the new GHC JS backend syntax.

I needed to make this change to get servant-jsaddle to work.

Have I done the correct thing here? I'm particularly dubious about replacing the $c argument with a named variable c.

If this is correct, I can make these changes throughout the codebase.

sevanspowell commented 6 months ago

Related to https://github.com/ghcjs/ghcjs-base/pull/136

hsyl20 commented 6 months ago

I'm particularly dubious about replacing the $c argument with a named variable c.

The name of the variable doesn't matter. But yes interruptible FFI functions take an additional continuation argument. See https://github.com/ghcjs/ghcjs-dom/blob/4f14a236a462523e094c749ead80aef3c8678617/ghcjs-dom-jsffi/jsbits/xhr.js#L1

sevanspowell commented 6 months ago

Thanks @hsyl20, this is the kind of feedback I need. I'll test that the suggestion works locally and post back here.

sevanspowell commented 6 months ago

I tested it locally with an xhr request and there was no issues :+1: