Live data from Hacker News

GHC now runs in the browser

discourse.haskell.org

11–20 of 131 posts

Re: GHC now runs in the browser

#11
post #3

Earlier quoted context omitted.

yeah why would anyone want to run code on a website

It would be more plausibly practical if GHC could now target wasm, but this announcement is actually about being able to run the compiler itself in the browser.

It can target wasm, the point of the post is that it’s now mature enough to be able to build itself for wasm and run in a browser.

Re: GHC now runs in the browser

#12
post #10

Earlier quoted context omitted.

I think the immediate and obvious case would be educational materials. Other than that, technical achievements need not always be practical to be cool :)

Agreed. Too many people said Haskell is only for academia, yet we’re seeing more quality software being released in Haskell over the past few years.

We are? Please share.

Re: GHC now runs in the browser

#13
post #3

Earlier quoted context omitted.

yeah why would anyone want to run code on a website

It would be more plausibly practical if GHC could now target wasm, but this announcement is actually about being able to run the compiler itself in the browser.

This is a show case of the wasm backend

Re: GHC now runs in the browser

#15
post #3

Earlier quoted context omitted.

yeah why would anyone want to run code on a website

Loading 50mb of WASM is a big tradeoff just to run code on a website.

I would assume that in the near future one can preload, cache, update selected WASM packages. I also imagine that sooner than that we can preload open models in the browser to run the natively instead of only invoking third parties (e.g. window.ai in the DOM)

Re: GHC now runs in the browser

#17
post #2

Interesting technical achievement but what would this be used for in practical terms?

Compilers are complicated. WASM has been a priority for the Haskell community for a while. Demonstrating GHC's ability to compile itself to WASM is thus a show that it is robust enough to compile a very complicated program into this backen.d

Re: GHC now runs in the browser

#18
post #2

Interesting technical achievement but what would this be used for in practical terms?

Have you ever used Godbolt? The Rust playground? The Typescript's playground? The Go playground?

It lets you have that without the pain of hosting compilers server side.

Re: GHC now runs in the browser

#19
post #16

Does it use WasmGC, or bundle its own garbage collector?

I think WasmGC is very hard to make work with laziness. A lazy value is always a closure on the heap.

If an expression might be unused, throw a closure which computes it on the heap

If the value is actually needed, invoke the closure. Optionally replace the closure with a black hole. A black hole is just a closure which pauses any thread which calls it, to be resumed once the first thread finishes with the expression

Once finished, replace with a closure which immediately returns the computation result. (Or often save the indirection because most concrete values also act as closures which immediately returns themselves using info table pointers trickery)

Anyway, iirc WasmGC wants very rigid types without dynamic type changes. Extra indirections could fix that, Oor maybe defunctionalizing thunks into a tagged union, but both sound expensive. Especially without being able to hook into the tracing step for indirection removal.

Also, Haskell supports finalizers so WasmGC would need that as well.

Re: GHC now runs in the browser

#20
post #10

Earlier quoted context omitted.

Agreed. Too many people said Haskell is only for academia, yet we’re seeing more quality software being released in Haskell over the past few years.

We are? Please share.

Pandoc is the first thing that comes to mind, but I also believe I have seen an uptick in software that I use being written in Haskell lately, though I can't remember what else off the top of my head.
Post reply on HN