Asterius – Haskell to WebAssembly Compiler
github.com
github.com
Despite the amount of derision Javascript and the web-as-a-platform idea is met with, the amount of innovation is undeniable. I personally think the web is the best platform (at the very least, it's the devil almost everyone knows) -- it's already ubiquitous, has more-than-good-enough solutions for most things and is supported by very huge companies and open source naturally. One of the main hangups for those who dislike the web-as-a-platform idea spreading usually call out the terribleness of Javascript the language -- and though I think transpiled solutions like Typescript[0] and Elm[1]/Purescript[2] fix this issue, the introduction of WASM will finally completely obliterate this long-standing hangup. You want to write some other language for your JS frontend? Soon you'll be able to.
JavaFX/QT/GTK/WxWidgets/etc people you had your chance (in the last decade or two) to create simple, cross-platform yet sufficiently feature full implementations and people are choosing bundling an entire browser to get away from the tools you're giving them. If someone develops a sufficient stripped down browser rendering interface or if projects like ion[3] take off, even more people (with relatively simple apps to write) will use the web platform I think.
As WASM gets better, the "native UI & speed" island is going to continue to shrink, in my estimation. Of course you've also got approaches like Flutter out there trying to render every single pixel (!), with enough weight to actually make it happen and provide full sets of widgets and even work on a desktop embedder[4] (shame about the only viable language being dart though...).
[0]: https://www.typescriptlang.org/
[1]: http://elm-lang.org/
[2]: http://www.purescript.org/
[3]: https://github.com/justinmichaud/ion
[4]: https://github.com/Drakirus/go-flutter-desktop-embedder
This is not an officially supported Google product. This is an exploratory effort, and is not part of the Flutter project.
It being under the google GitHub organization doesn't mean much about the backing, since Google demands copyright for all kinds of things their employees do.
My vague understanding that might be outdated by a few years is that LLVM isn't a very nice target for garbage collected languages. It does have support for GC hooks, stack maps etc., but somehow people are (were?) struggling to make it all work efficiently in the real world.
There must be other factors as well, as a Haskell LLVM backend has existed for years. Here's a list of problems with LLVM for this use case pointed out two years ago: https://ghc.haskell.org/trac/ghc/wiki/ImprovedLLVMBackend
I have used it[0] a year ago and despite my shallow understanding of Haskell, I have managed to port my CLI app to Haskell fairly easily!
I guess parts of the c code could be transpiled but something low-level like the gc relies on details like register pinning.
https://en.wikipedia.org/wiki/Lisp_machine
"Lisp Hardware Architecture: The Explorer II and beyond"
https://3e8.org/pub/scheme/doc/lisp-pointers/v1i6/p13-dussud...
"Garbage collection in a large LISP system"
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.125....
"KIM 20 : A SYMBOLIC RISC MICROPROCESSOR FOR EMBEDDED ADVANCED CONTROL "
https://www.computer.org/csdl/proceedings/easic/1990/2066/00...
The failed iAPX 432 processor from Intel also supported it.
https://en.wikipedia.org/wiki/Intel_iAPX_432#Garbage_collect...
Depending on how the runtime for "native Haskell" is implemented, the effort might be everything from just cross-compile it to building a completely separate runtime.
Old Frameworks have to do perverse things to break those cycles, and if they don't, the browsers leaked memory over time.
It would be sad if that came back to modern browsers, due to WASM and DOM using separate collectors. Or worse, multiple WASM components, (perhaps in different languages, perhaps not, but all different collectors), holding indirect, accidental references to each other because someone decided to use the components in the same DOM.
It'll be a copying GC, with builtin support to automatically free unused JavaScript references in the Haskell heap. It's also possible to plug in more fancy gc algorithms later (e.g. generational, or concurrent ones with read barriers).
There does exist a wasm anyref proposal which enables manipulating opaque references in wasm and a gc proposal for further allocating/using such garbage collected objects. However, basing our gc on those is currently less pragmatic than rolling our own :)
> $.getJSON("/cgi-bin/trypandoc", { from: from, to: to, text: text },