-
-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GHC WebAssembly/JS backend support #724
Comments
According to the IOG blog ghcjs-base and friends have been updated to support the ghc js backend, so I think that means this issue has finally become actionable :). |
Everything seems to compile on ghc 9.10-alpha3 from ghcup and head.hackage with this patch diff --git a/miso.cabal b/miso.cabal
index dd27739..bf2a39a 100644
--- a/miso.cabal
+++ b/miso.cabal
@@ -137,6 +137,7 @@ library
hs-source-dirs:
text-src
build-depends:
+ ghcjs-base,
aeson,
base < 5,
bytestring,
diff --git a/src/Miso/Html/Types.hs b/src/Miso/Html/Types.hs
index 3310fda..a2b4dfb 100644
--- a/src/Miso/Html/Types.hs
+++ b/src/Miso/Html/Types.hs
@@ -65,7 +65,7 @@ import Text.HTML.TagSoup (Tag(..))
import Miso.Effect
import Miso.Event
import Miso.FFI
-import Miso.String hiding (reverse)
+import Miso.String hiding (elem, reverse)
-- | Core type for constructing a `VTree`, use this instead of `VTree` directly.
data View action I use the command
But I run out of memory during linking of the first demo application in the README. Only have 8G of RAM on this laptop, will try another machine some other day if nobody else in this thread has time... |
I ran the test suite (needed a change for aeson-2) and also had to pass edit: apparently have to run the test through the browsers. There I get:
|
As another resource: We have some examples of how to use Miso with the WASM backend here: https://github.com/tweag/ghc-wasm-miso-examples |
Fixing that with a
The offending generated code is: function h$$72640042() {var a=h$stack[(h$sp-1)];
h$sp-=2;
window.global_test_results = $1;(a);
return h$rs();
}; |
Doesn't work here: tweag/ghc-wasm-miso-examples#10 |
Seems like the JavaScript part of this issue is addressed in: |
Is your feature request related to a problem? Please describe.
ghcjs is a bit outdated and stuck at ghc 8.*
Describe the solution you'd like
both tweag's WebAssembly backend and a new JS backend were recently merged into GHC 9 and will probably get the most support going forward wrt haskell on browsers
Additional context
the new JS backend talks about not being complete enough yet (missing Template Haskell) and the WebAssembly backend I don't know if has access to the DOM
anyways, would be exciting!
The text was updated successfully, but these errors were encountered: