Stream: contributing

Topic: html and related packages


view this post on Zulip Georges Boris (Jul 10 2022 at 11:20):

is someone working on an html/browser platform?

I'm interested in contributing to this ecosystem by starting to create some packages for that domain even if the platform itself is far from ready. would that make sense at this moment? should I wait?

I'm the creator of elm-book and I'm also preparing a suite of other UI libs for Elm. I'd be glad to maintain similar ones for the Roc world.

view this post on Zulip Brian Carroll (Jul 10 2022 at 11:27):

Hi Georges! Nobody's working on that at the moment, no. Would be great to have you involved! Some thinking has been done about it though, by Richard and myself and maybe others.

view this post on Zulip Brian Carroll (Jul 10 2022 at 11:27):

The Elm architecture won't work well exactly as-is, for various reasons. Richard wrote up a document about it here https://docs.google.com/document/d/16qY4NGVOHu8mvInVD-ddTajZYSsFvFBvQON_hmyHGfo/edit

view this post on Zulip Brian Carroll (Jul 10 2022 at 11:27):

That's a good place to start. It's fairly long but worth a read before getting into this.

view this post on Zulip Brian Carroll (Jul 10 2022 at 11:31):

I did a project a while ago to port Elm to Wasm. I managed to get Richard's Elm SPA Example to compile and run. The performance was roughly similar to JS. The biggest bottleneck by far is encoding JS values to bytes and decoding them back again. The architecture of a front end framework for Roc would need to be designed around how to minimise these "border crossings".

view this post on Zulip Brian Carroll (Jul 10 2022 at 11:32):

I have lots of experience with this sort of thing from that previous project and would be happy to help.

view this post on Zulip Brian Carroll (Jul 10 2022 at 11:35):

Click handler functions are tricky, for example. The design I have in mind is that the JS handler attached to the DOM node would simply send an integer ID to the Wasm module to indicate "event handler 123 fired". Then the Wasm module would look up some sort of dictionary of lambdas to call.

view this post on Zulip Brian Carroll (Jul 10 2022 at 11:36):

But the user might want to decode the JS event object. Unfortunately those event object contain circular references so are not actually serializable. You have to get the app developer to provide a list of fields to decode, then JSON.stringify only those fields and write them into the Wasm module for further JSON deserialization.

view this post on Zulip Georges Boris (Jul 10 2022 at 22:27):

thank you! just read through it -

view this post on Zulip Brian Carroll (Jul 10 2022 at 22:40):

Have a look in examples/gui in the repo.
An app can only use one platform at a time.


Last updated: Jul 06 2025 at 12:14 UTC