I've recently discovered Om which I think is a beautiful example of why FP matters in modern day computing.
Basically what Om showed was that by using immutable data for state in React.js one could easily outperform similar apps written in OOP style. The reason why it is so much faster is that component should update only has to check for referential equality instead of deep equality. This is a much more efficient way to trigger updates.
Om uses constructs similar to lenses and zippers to easily modify state (they call them cursors) which is extremely cool.
Haskell has a strong lens implementation (we kinda coined that term, didn't we? ;-)) and that's why I started wondering wether I could port Om (or React) to Haskell.
That way I can use my favorite language to build robust and super fast web applications. A dream come true.
So yeah. Here we go. it's time to build Hom! A haskell version of Om! (I'm kind of excited :-))
I'm Considering several options for Haskell->JS conversion. The following Pros and Cons are constructed from first impressions I got from skimming documentations so they might be incorrect. Please correct me when one of the pros or cons is wrong!
GHCJS
Pros
- Fully compactible with all GHC packages
- straightforward FFI
Cons
- very large runtime system
- packages draw in a lot of dependencies, creating huge generated code
Fay
Pros
- Small runtime system
- Small generated code
- Pretty darn fast
- Great FFI.
Cons
- No typeclasses so no Lenses. Kinda defeats the purpose of choosing haskell in the first place
Haste
Pros
- Compactible with most GHC-Compactible packages
- Smaller runtime system than GHCJS
- Good concurrency constructs
Cons
- Not sure how good the FFI is. What I've seen so far looked a bit clunky compared to UHCJS but maybe I need to get a bit more familiar with it.
UHCJS
Pros
- Very extensive javascript FFI. probably the best I've seen.
- Maintained by my university (Not really a pro. just exciting)
Cons
- Doesn't support GHC. UHC is a different standard. I think it supports upto haskell2010 though
I think I will go for Haste for now. Though UHCJS sounds really attractive as well to be honest. Fay is just a no-go because I want the sexy lens library!
Next time I'm gonna work out some API design decisions etc. The problem is I really don't have a lot of time to start coding yet because of university work. I really want to start building this library because I want it so bad!
Any feedback is appreciated. Also if someone is already working on something similar to this, let me know.