Live data from Hacker News

Asterius – Haskell to WebAssembly Compiler

github.com

21–30 of 36 posts

Re: Asterius – Haskell to WebAssembly Compiler

#21

Client-side pandoc would actually be reaaaal interesting

As far as I'm concerned, it already exists in two forms: 1. https://try.pandoc.org/ 2. http://markup.rocks/

(1) isn’t client-side.

> $.getJSON("/cgi-bin/trypandoc", { from: from, to: to, text: text },

Re: Asterius – Haskell to WebAssembly Compiler

#22
post #14
post #12

Earlier quoted context omitted.

Most likely the same way as in any hardware CPU without support for GC memory tagging.

What is hw support for GC mem tagging? I didnt realize such a thing existed.

It existed on Lisp machines.

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...

https://news.ycombinator.com/item?id=9448712

Re: Asterius – Haskell to WebAssembly Compiler

#23
post #18
post #14

Earlier quoted context omitted.

What is hw support for GC mem tagging? I didnt realize such a thing existed.

It's something that has been researched, but not deployed. It would implement GC memory tagging in the CPU or even the memory controller. Google Scholar should produce some good hits.

Surely it was deployed, in the original Lisp Machines hardware.

Re: Asterius – Haskell to WebAssembly Compiler

#24

Surprised to see that no one has mentioned GHCJS " rel="nofollow">https://github.com/ghcjs/ghcjs> still. 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! [0]: https://github.com/boramalper/boolexman

It's not the same though. GHCJS is a Haskell to JS source compiler (transpiler?). Webassembly is a lower level altogether.

Re: Asterius – Haskell to WebAssembly Compiler

#25

I'm curious how they solve garbage-collection, since last time I checked WebAssembly doesn't yet support that?

The consensus of "the same way they do in native code" is a probable approach, but it's worth calling out an additional complication in this setting: you might wind up working with two garbage collectors, with references in one keeping objects in the other alive. This isn't intractable, but it is messy.

Re: Asterius – Haskell to WebAssembly Compiler

#26

I'm curious how they solve garbage-collection, since last time I checked WebAssembly doesn't yet support that?

Hi, asterius main dev here. Garbage collection support is near; we're working actively on it, and after a few regressions are fixed it'll be available on master.

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).

Re: Asterius – Haskell to WebAssembly Compiler

#27
post #24

Surprised to see that no one has mentioned GHCJS " rel="nofollow">https://github.com/ghcjs/ghcjs> still. 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! [0]: https://github.com/boramalper/boolexman

It's not the same though. GHCJS is a Haskell to JS source compiler (transpiler?). Webassembly is a lower level altogether.

It's not the same. It's certainly relevant.

Re: Asterius – Haskell to WebAssembly Compiler

#28

I'm curious how they solve garbage-collection, since last time I checked WebAssembly doesn't yet support that?

The consensus of "the same way they do in native code" is a probable approach, but it's worth calling out an additional complication in this setting: you might wind up working with two garbage collectors, with references in one keeping objects in the other alive. This isn't intractable, but it is messy.

Yes, like the IE memory leaks (and early Mozilla leaks) where DOM and JavaScript objects are collected in a different way, so can easily get stuck in unfreeable reference cycles.

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.

Re: Asterius – Haskell to WebAssembly Compiler

#29
post #17

Earlier quoted context omitted.

Are those sites using Emscripten or just passing your docs to a server to process?

Markup.rocks says it is client side and appears to be using ghcjs: https://github.com/osener/markup.rocks/blob/master/Makefile#...

Cool! Right now I run a docker container with pandoc on heroku in order to do stuff like make decent PDFs from my iPad... hmm...

Re: Asterius – Haskell to WebAssembly Compiler

#30

I'm curious how they solve garbage-collection, since last time I checked WebAssembly doesn't yet support that?

Hi, asterius main dev here. Garbage collection support is near; we're working actively on it, and after a few regressions are fixed it'll be available on master. 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).

To be clear, this will be your own GC bundled with each application, not an interface to the host browser's GC?
Post reply on HN