-
Notifications
You must be signed in to change notification settings - Fork 162
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
Switching back to GHCJS 7 #660
Comments
It's not trivial to switch out GHC versions and get all the dependencies reflex-platform is trying to maintain to work out. An upgrade between two different versions of 8.x took around a week of fighting with various dependencies, to give some idea of the challenge. Also, there are patches like text-jsstring which you'll likely have to find versions which work on the old ghcjs as well. Also, you may have to use old versions of many other libraries, since there are extensions and features that were introduced with GHC 8.0 and at various points afterwards that many libraries rely on. I wouldn't recommend this approach, honestly. Have you tried using ordinary ghci to run your application via jsaddle? |
Getting an ordinary GHCi REPL works fine, but the reason I'd like to use GHCJSi is because I need the JS output to update whenever I change the Haskell source (using ghcid). Do you know of some other way to get that "live-reloading" behavior? |
Why do you need the JS to change? If you're using jsaddle, the javascript it's serving up shouldn't change between runs, it's a client that gets connected to by your app, and commands that cause javascript things to occur are issued to it over a websocket. This happens pretty much transparently, because the ghcjs-dom library is implemented in terms of jsaddle's abstraction, so all the stuff you ordinarily do to cause javascript to run will work whether you're compiling to JS or native code. |
To be honest I didn't exactly understand everything you've just written, but maybe I'm just approaching this in the wrong way. I would use a bundler (like parcel or webpack) to bundle the GHCJS output and some other stuff (stylesheets, static content) and use the bundler's development server to access the frontend. The backend would run somewhere else. |
Well, that's how you would deploy, but for development, surely you wouldn't be doing that, right? You can just run the main widget in GHCi, and if it's compiled the right way, you get a jsaddle server running that you can open in a web browser. The frontend runs in native code then, but sends bits of javascript and the results back and forth with the web browser over a websocket. When you eventually compile with ghcjs, you'll get a bunch of javascript, and the mode of operation will be different, but for the most part, the app will look the same to the user. (...and yeah, check out Obelisk, if you haven't already, it makes all this quite straightforward.) |
Thanks a lot for the explanations! I've tried Obelisk but didn't really find it easy to use since there is basically no documentation on the routing story. Now I'm using reflex-platform to run the frontend in GHCi via jsaddle-warp and it works really well. |
@malte-v Thanks for the feedback. Getting docs for routing is pretty high priority. But in the meantime feel free to open issues against Obelisk as you explore it. |
Could you in a little more detail on that approach? I was using the repl to get hints, types and error messages in my IDE. How do I accomplish a similar thing with just jsaddle?
|
@developandplay Have you been using GHCJSi? |
@malte-v Sorry that might have come across in the wrong way. I was using GHCi previously and am completly new to GHCJSi. |
@developandplay Why do you want to use GHCJSi? As far as I know it is no longer supported and GHCi is faster. You can easily compile your Reflex-Dom code with GHC using jsaddle-warp or jsaddle-webkit2gtk. GHCJS should only be needed when deploying, but for development purposes and IDE stuff I only use GHC(i). |
@malte-v Thank you for pointing that out! Older tutorials used to mention GHCJSi for repl so I assumed that's the way to go. |
Mind pointing out these older tutorials which do that? It would be good to update them or add some sort of "out of date" notice. |
This was on a few guides of the Miso framework . As a beginner that seemed simpler than reflex to get started. |
I'd like to use GHCJS 7 with
reflex-platform
because GHCJS 8 doesn't support the REPL (see ghcjs/ghcjs#549). Is there a straightforward way to use that version of the compiler? Thanks!The text was updated successfully, but these errors were encountered: