Stream: beginners

Topic: Extending platforms to expose custom data types


view this post on Zulip Austin Davis (Sep 15 2025 at 21:51):

I was working on my compiler project in Roc (which uses the basic-cli platform), and it occurred to me that I may need some kind of persistent immutable hashmap that can handle a gigantic number of consecutive "read-then-write" operations in a hot loop. I was kinda thinking a hash array mapped trie (HAMT) might be the right approach, but that's a difficult thing to implement in Roc.

So...

Maybe I could just borrow a HAMT off the shelf from the host language? I was wondering how difficult it would be to simply fork and extend the platform.

Obviously I'm not at that point yet. Not even close. I would need to do some performance testing before that becomes a real concern. But it just got me thinking about the possibilities. Has anyone here ever done something like that?

view this post on Zulip Luke Boswell (Sep 15 2025 at 22:08):

Forking the platform and adding a couple of new effects is easy to do I think. I can help you if you need.

view this post on Zulip Anton (Sep 16 2025 at 07:59):

A PR like https://github.com/roc-lang/basic-cli/pull/380/files may be useful to see which files you need to alter

view this post on Zulip Austin Davis (Sep 22 2025 at 21:32):

Awesome, I will take a look at the repos and see what I can dig up. Thanks for the info!


Last updated: Oct 18 2025 at 12:13 UTC