r/haskell • u/saurabhnanda • Sep 10 '17
Benchmarks: GHCJS (Reflex, Miso) & Purescript (Thermite, Pux, Halogen)
https://medium.com/@saurabhnanda/benchmarks-fp-languages-libraries-for-front-end-development-a11af0542f7e
99
Upvotes
21
u/eacameron Sep 10 '17 edited Sep 10 '17
It took me a while to discover it, but Reflex-DOM supports
jsaddle-warpwhich actually makes the tooling story for Reflex-DOM fantastic. All of Reflex-DOM (and most of its ecosystem) compile easily with GHC (not just GHCJS). When developing Reflex-DOM apps, I can run my front-end and back-end code from the same server and get near instantaneous updates as soon as it hit "Save". This is possible with ajsaddle-warpserver that gets run byghcid --test. Every time I change the code,ghcidimmediately restarts thejsaddle-warpserver and my page automatically refreshes.Not only that, but I use
intero(VSCode with Haskero) without any issues for Reflex-DOM code because all development is done with GHC (not GHCJS). I have just as much tooling with GHCJS as I do with GHC because I only use GHCJS to build the final JS output.Here's a snippet of my setup for auto-reload: https://gist.github.com/3noch/ee335c94b92ea01b7fee9e6291e833be
10
u/AllTom Sep 10 '17
What does "keyed" mean?
17
u/eacameron Sep 10 '17
This is a sorely needed comparison. Thank you very much for your hard work and contribution on this issue.
7
u/Tysonzero Sep 10 '17
It would be nice to see react-hs on that comparison as well. It's currently what I am using in production.
https://github.com/liqula/react-hs
20
u/ElvishJerricco Sep 10 '17
I won't comment on any of the other frameworks, since I have no domain knowledge in them. But I will say a couple of things about Reflex.
In general, DOM-diffing is not a necessary technique. With an efficient representation of behaviors and events, you can just change the DOM directly rather than producing an entire new tree and running a whole diffing algorithm. This can add some mental overhead on occasion, but usually not, since things tend to take dynamic arguments anyway, meaning they're already doing that logic. When it does come up, it's almost always a case of "
widgetHoldand its derivatives will redraw the entire child widget on each update." If you just keep that in mind, it's pretty easy to reason about what techniques will obviously cause problems.I think this is a major pain point. In my experience using Reflex in some complicated code, there are some valuable guidelines for architecting things. But none of this seems to be documented anywhere.
0
u/barsoap Sep 10 '17
Speaking of targeting javascript: Why isn't there a GHC and/or purescript build running on javascript?
Alternatively, I'd take an ARM or JVM/Dalvik build. Seriously! I'm literally stuck with C, lua, and tiny tiny lisps on Android. "Java" is also kind of there (both ecj and clang come with termux), just don't think that any Java program will actually run, there's no proper JRE present.
0
u/[deleted] Sep 11 '17
[deleted] — view deleted comment