Skip to content

Conversation

@dmjio
Copy link

@dmjio dmjio commented Feb 19, 2025

Need synchronous variants that return values. Unsure if this is the preferred way to re-export for jsaddle.

@dmjio dmjio force-pushed the re-export-callback branch from 0754dff to c116810 Compare February 19, 2025 22:07
@dfordivam
Copy link
Contributor

As the jsaddle does not support returning values in the "non-ghcjs" mode, may be it is better not to add these here, and rather directly use them from the module they are defined.

(There exist a wip implementation of jsaddle on my fork which does support proper handling of sync callbacks, including returning values and exception handling, in all modes like warp and android)

@dmjio
Copy link
Author

dmjio commented Feb 20, 2025

Well maybe we can still export these from jsaddle but wrap them in function' (similar to the function jsaddle already defines for syncCallback ContinueAsync). The issue is that jsaddle does not expose these functions to users at all, which is essentially missing functionality. The reason I think it should live in jsaddle is that jsaddle is acting like an abstraction layer over different architectures, yet exposing the same API.

(There exist a wip implementation of jsaddle on my fork which does support proper handling of sync callbacks, including returning values and exception handling, in all modes like warp and android)

Do you think this will get merged?

@dmjio
Copy link
Author

dmjio commented Feb 20, 2025

To be clear as well, these are not from ghcjs but from the new js backend. These functions are exposed from base. The ghcjs_HOST is apparently true for both platforms.

@dfordivam
Copy link
Contributor

dfordivam commented Feb 20, 2025

yet exposing the same API.

I meant this will not be possible if there does not exist an API to return value from sync callback on jsaddle-warp.

Do you think this will get merged?

Not really, it is significantly different now and will remain as a fork.

@dmjio
Copy link
Author

dmjio commented Feb 20, 2025

Ah I see, then it sounds like we need some Callback newtype to generalize over ghcjs-base, GHC.JS.Foreign.Callback, and the WASM Callback type.

@dmjio
Copy link
Author

dmjio commented Feb 22, 2025

(There exist a wip implementation of jsaddle on my fork which does support proper handling of sync callbacks, including returning values and exception handling, in all modes like warp and android)

Which branch on your jsaddle fork has these features? @dfordivam

@dfordivam
Copy link
Contributor

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