Skip to content

Use new JS backend syntax in js_send foreign import#105

Merged
hsyl20 merged 3 commits intoghcjs:masterfrom
sambnt:master
May 6, 2024
Merged

Use new JS backend syntax in js_send foreign import#105
hsyl20 merged 3 commits intoghcjs:masterfrom
sambnt:master

Conversation

@sevanspowell
Copy link
Contributor

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
Copy link
Contributor Author

Related to ghcjs/ghcjs-base#136

@hsyl20
Copy link
Contributor

hsyl20 commented May 6, 2024

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

function h$dom$sendXHR(xhr, d, cont) {

Co-authored-by: Sylvain Henry <sylvain@haskus.fr>
@sevanspowell
Copy link
Contributor Author

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

@sevanspowell
Copy link
Contributor Author

sevanspowell commented May 6, 2024

I tested it locally with an xhr request and there was no issues 👍

@hsyl20 hsyl20 merged commit 9b4b41a into ghcjs:master May 6, 2024
hamishmack added a commit that referenced this pull request May 7, 2024
PR #105 relaxed the `ghcjs-base` bound on `ghcjs-dom-jsffi`, but the fix was for `ghcjs-dom-javascript`.  We should not be using both `ghcjs-dom-jsffi` and `ghcjs-dom-javascript` at the same time.

Packages should either depend on `ghcjs-dom` only (and let it choose the correct implementation library) or do something like:

```
if impl(ghc >9)
  build-depends: ghcjs-dom-javascript
else
  build-depends: ghcjs-dom-jsffi
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants