Comments (14)
Thanks for replying. Do you know of any benchmark that compares Haste &
GHCJS on size+speed of compiled JS code?
On Mon, Aug 22, 2016 at 5:39 PM, Ryan Trinkle [email protected]
wrote:
When I last checked, Haste did not support System.Mem.Weak. Reflex
requires weak references in order to work properly, and I doubt that it is
possible to write an FRP system that doesn't require them. There may be
other features that Haste doesn't have, but this is the big one I know of.—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#86 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AABu0UnB_3EXVt5ZgOygPu0fv331km8dks5qiZFygaJpZM4JpmYb
.
from reflex-dom.
When I last checked, Haste did not support System.Mem.Weak. Reflex requires weak references in order to work properly, and I doubt that it is possible to write an FRP system that doesn't require them. There may be other features that Haste doesn't have, but this is the big one I know of.
from reflex-dom.
No problem! Since Haste can't support Reflex at a technical level, I haven't put any time into testing or benchmarking it. However, my guess would be that its output is probably smaller and at least a little faster.
from reflex-dom.
I know this doesn't concern the reflex-frp project, but if you could indulge me a little bit, what is the technical difference between Haste & GHCJS? From Haste's home page:
Haste is an implementation of the Haskell functional programming language, geared towards web applications. Haste is based on the de facto standard GHC compiler, which means that it supports the full Haskell language, including GHC extensions and produces highly optimized code but comes with an extended set of standard libraries.
Is System.Mem.Weak a GHC core feature or a GHCJS extension?
from reflex-dom.
GHC compiles Haskell code by performing a series of transformations into lower and lower level representations. Something like this: Haskell -> A -> B -> C -> Assembly language.
Haste and GHCJS do not compile Haskell directly to Javascript. They use GHC to perform some of those transformations, then jump in and convert one of the intermediate representations to Javascript. My understanding is that the basic technical difference between Haste and GHCJS is that GHCJS jumps in at a lower level in the chain. So if we use my above notional GHC diagram, it would be something like this:
Haste: B -> Javascript
GHCJS: C -> Javascript
The further down you start, the more closely you will match GHC.
from reflex-dom.
Thanks for the explanation @mightybyte
It seems that System.Mem.Weak
is core to GHC and Haste source code has some references to it
from reflex-dom.
Yes, System.Mem.Weak is a core library for GHC. Although Haste does have stubs for it, as you can see, it does not actually function as a weak reference: https://github.com/valderman/haste-compiler/blob/9dbd810d3bc9aade6bb63746ff784690e7674554/lib/Weak.js
The net result of this is that anything relying on weak references will (presumably) leak memory on Haste.
from reflex-dom.
Is this the only problem keeping reflex-frp from using Haste as a compiler? Did anyone try pestering the Haste team to implement weak-reference properly?
Btw, will reflex-starter at least compile on Haste, ignoring the memory leak for a moment?
@ryantrinkle I remember chatting about weak references on IRC as well. Would it be possible to explain why/how reflex-frp uses them and why they're required for JS callback (IIRC)? Btw, this comment says that they're not required since JS implements its own GC. Is it a misguided comment?
from reflex-dom.
Feel free to close this issue if Haste is not on your roadmap at all. I'm just trying to understand things better. From a production standpoint, Haste's smaller JS size & better speed is obviously desirable.
from reflex-dom.
@saurabhnanda @luite is working on JS size right now. He expects GHCJS to have better JS size in the next couple months.
from reflex-dom.
From Haste's Github repo:
Supports all GHC extensions except Template Haskell
That could a significant downer for people using Persistent to generate common record-types to share between frontend and backend.
from reflex-dom.
@saurabhnanda I don't know what will/won't work on Haste. Reflex also uses STM, which is a pretty advanced feature, so it's possible that would also be an issue. I'm not sure whether reflex-starter will work with Haste, but if you try it, i'd love to hear how it goes!
I believe the Haste comment is incorrect. As far as I know, JavaScript's built-in GC does not support weak references, so a (substantially) more complex approach to provide their behavior.
Haste is not on my roadmap for now, but I'm more than happy to discuss it, and it would be great if it supported reflex in the future.
And, yes, Template Haskell is extremely important, at least for my applications.
from reflex-dom.
Here's my short-lived experience FWIW :)
from reflex-dom.
Closing, since I think we've gone over the major points. Feel free to continue the discussion, and we can reopen if necessary.
from reflex-dom.
Related Issues (20)
- Using stack and only GHC (not GHCJS) for building a reflex-dom app HOT 4
- Compiler error with Reflex.Dom.Prerender HOT 4
- Static renderer's handling of some config items is incorrect
- Collection widget content gets deleted on page load completion with ghcjs
- Why does DomRenderHook run in sync callback HOT 2
- inputElementConfig_initialValue doen't work after reload HOT 4
- Is MountableDomBuilder a deadcode
- Checked property doesn't work correctly for radio inputs HOT 1
- `inputElement` initial value does not show and `setValue` does not work for custom event HOT 2
- Building on Windows.
- Support multiple form data values to be associated with the same name
- Error building release.nix: bitbucket.org/wuzzeb/webdriver-utils/get/a8b1552... returns 404 HOT 3
- sortableList.hs example outdated
- How to set focus of an element HOT 6
- reflex-dom-core is not compatible with patch >= 0.0.5.0 HOT 2
- implement _*ElementConfig_setFocus HOT 1
- How to debug: jsaddle requests: 101 pending
- Support GHC 9.2.3
- play method of audio element HOT 2
- Missing HTTP headers get reported as the empty string
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reflex-dom.