[Haskell-cafe] [ANNOUNCE] GHC 9.6.1-alpha2 is now available

Olaf Klinke olf at aatal-apotheke.de
Tue Jan 31 16:36:34 UTC 2023


This may be a naive question and I may be completely misunderstanding
what WebAssembly is all about:
What can the Haskell developer expect once the WebAssembly and
JavaScript backends of GHC have matured? I dream of a commutative
square like follows. 

    f
x -----> y      Haskell source
|        |
|GHC     |GHC
|        |
v        v
b -----> b      HTML
    w

GHC would become a functor from (a sub-category of) Hask to a category
with one object and a rich hom-set of (serializable) endomorphisms.
Cloud Haskell [0] seems to provide a functor of this kind. 
In detail, for a pure Haskell function between Haskell types x and y,
the compiler would be able to map values to a web representation b and
compile f to a web representation w :: b -> b. The latter should be
embeddable in static HTML [1], so that a client-server architecture is
not needed. 
There are obvious limitations, e.g. when b = JSON and w is a JavaScript
function, then x and y may be limited to Generic types. 
One application of this functor would be a web version of Haskintex
[2], where one can ensure that certain elements of a document have a
relationship y = f(x) defined by a Haskell function. But unlike
Haskintex, the computation would take place not at create-time but at
display-time so that a limited amount of interaction is possible. 

Olaf

[0] https://hackage.haskell.org/package/distributed-static
[1] According to [3], WebAssembly is currently designed to be fetched,
not embedded. This appears to be no fundamental restriction, however,
as binary images can also be embedded in static HTML.
[2] https://hackage.haskell.org/package/haskintex
[3] https://developer.mozilla.org/en-US/docs/WebAssembly/Loading_and_running



More information about the Haskell-Cafe mailing list