miso icon indicating copy to clipboard operation
miso copied to clipboard

Update examples to use new JS backend syntax

Open sevanspowell opened this issue 1 year ago • 2 comments

  • Three miso examples (canvas2d, file-reader, and threejs) make use of foreign imports. These need to be updated to the new GHC JS backend syntax in order to work with the new GHC JS backend.
    • I'm not sure these updates are backwards compatible, so I might have to conditionally introduce these changes (@hamishmack ?).
  • Additionally https://github.com/ghcjs/ghcjs-base/pull/136 must be merged to fix issues with ghcjs-base introduced in https://github.com/ghcjs/ghcjs-base/pull/135. The examples will fail to run otherwise.

sevanspowell avatar May 03 '24 09:05 sevanspowell

Thanks for doing this, in order to ensure it works we'll need to update miso's nix scripts to use the new ghcjs.

@stepcut has pointed out that nix-shell -p 'pkgsCross.ghcjs.haskell.packages.ghcHEAD.ghcWithPackages (p: [ ])' is working now on nixpkgs-unstable, but it seems a lot of dependencies are still broken

dmjio avatar May 03 '24 17:05 dmjio

Thanks for your work on the project!

I'll do my best to help out with that process.

sevanspowell avatar May 04 '24 10:05 sevanspowell

Can confirm this fixes build failures: https://github.com/NixOS/nixpkgs/pull/380737 I found this PR after running into

Building executable 'file-reader' for miso-examples-1.8.5.0...
[1 of 1] Compiling Main             ( file-reader/Main.hs, dist/build/file-reader/file-reader-tmp/Main.o )
file-reader/Main.hs:15:1: error: [8;;https://errors.haskell.org/messages/GHC-61948GHC-619488;;]
    Could not find module ‘GHCJS.Foreign.Callback’.
    Perhaps you meant GHC.JS.Foreign.Callback (from base-4.21.0.0)
    Use -v to see a list of the files searched for.
   |
15 | import GHCJS.Foreign.Callback

alexfmpe avatar Feb 09 '25 22:02 alexfmpe

Probably want to do a hackage release with this and #752

alexfmpe avatar Feb 09 '25 22:02 alexfmpe

@alexfmpe @sevanspowell

- import GHCJS.Foreign.Callback
+ import GHC.JS.Foreign.Callback

Will break GHCJS builds, at the very least we should use CPP to make this a backwards compatible change. Same for the FFI declarations.

dmjio avatar Feb 09 '25 22:02 dmjio

Merged in #757 @alexfmpe @sevanspowell .

@alexfmpe I'll get a release out for https://github.com/NixOS/nixpkgs/pull/380737

dmjio avatar Feb 10 '25 00:02 dmjio

https://hackage.haskell.org/package/miso-1.8.6.0

dmjio avatar Feb 10 '25 04:02 dmjio