Skip to content

Update examples to use new JS backend syntax#740

Closed
sevanspowell wants to merge 4 commits intodmjio:masterfrom
sambnt:master
Closed

Update examples to use new JS backend syntax#740
sevanspowell wants to merge 4 commits intodmjio:masterfrom
sambnt:master

Conversation

@sevanspowell
Copy link
Contributor

- Javascript conventions have changed slightly with the GHC Javascript
  backend (from GHCJS).
  - See https://github.com/ghcjs/ghcjs-base/pull/135/files.
- Update foreign imports to match these new conventions, so compiling with GHC
  Javascript backend works.
- Update canvas2d to work with new JS backend syntax.
@dmjio
Copy link
Owner

dmjio commented May 3, 2024

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

@sevanspowell
Copy link
Contributor Author

Thanks for your work on the project!

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

@alexfmpe
Copy link
Contributor

alexfmpe commented Feb 9, 2025

Can confirm this fixes build failures: NixOS/nixpkgs#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
Copy link
Contributor

alexfmpe commented Feb 9, 2025

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

@dmjio
Copy link
Owner

dmjio commented Feb 9, 2025

@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
Copy link
Owner

dmjio commented Feb 10, 2025

Merged in #757 @alexfmpe @sevanspowell .

@alexfmpe I'll get a release out for NixOS/nixpkgs#380737

@dmjio
Copy link
Owner

dmjio commented Feb 10, 2025

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.

3 participants