[Haskell-cafe] Should webassembly be a target for GHC?

Joachim Durchholz jo at durchholz.org
Sat Apr 23 08:52:35 UTC 2016


Am 23.04.2016 um 06:28 schrieb Dimitri DeFigueiredo:
> I'm interested in webassembly's recent momentum
>
> https://hacks.mozilla.org/2016/03/a-webassembly-milestone/
>
> Is this a way we could get a foot in the web?
> I'm curious, just putting the thought out there.

Points to consider:

ITfind commented that he'd expect browser support to happen in around 
3-5 years.

My own comment would be the question whether it's going to happen at 
all, or peter out.

Then there's the question whether Webassembly will be Haskell-friendly. 
It might be a good idea for some Haskell compiler expertise to 
participate in the interest group to make it so.

Also, the purpose of WebAssembly will be to integrate with the browser's 
DOM and with Javascript library. These interfaces are inherently 
stateful, so whether that can succeed will massively depend on good 
Haskell library support. In particular, it will need to appeal to web 
developers, most of which will come from a Javascript background; that's 
quite a cultural gap that the Haskell-side library will have to bridge. 
I think the interface libraries will have to be designed by somebody who 
is at home and in love with both environments.

Finally, any interface libraries that will have to be downloaded from 
web pages should be small. Less than 100k. Page bloat is a real and 
serious problem.

Haskell could actually take off if it turns out that Haskell-generated 
Webassembly is smaller than Webassembly generated from other languages. 
Given that Haskell code tends to have a higher abstraction level than 
code written in other languages, that's quite possible; however, the 
entire compiler needs to be configured towards small footprint to 
achieve that goal, expect work required towards that end.

Just tinkering with Webassembly won't make Haskell get a foot in the 
web, but it may provide valuable insights into how Haskell might 
interface with the Next Big Thing of That Kind, whatever that will be, 
so tinkering would be a project in its own right.
If the goal is to get a foot in the web, that's going to require a lot 
of manpower, and the Haskell compiler crowd will have to contribute at 
least advice and problem analysis.
Like you I'd like to see that happen but can't make much happen myself; 
the best I can do is to look how the journey might be, and hope somebody 
who can do actual work on that is will pick up what's useful about my 
thoughts.


More information about the Haskell-Cafe mailing list