Stream: contributing

Topic: Generating glue code


view this post on Zulip Daniel Rivas (Feb 22 2024 at 13:56):

Hi everyone,

I'm trying to finish up https://github.com/roc-lang/basic-cli/pull/173 -- the work remaining involves updating the Rust definition to actually pass the given timeout to the Roc code. In order to do that, I think I need to update the definition of glue::Response::Timeout, which I gather is generated by running roc glue.

My question is how to do that correctly for basic-cli? The roc glue command requires <GLUE_SPEC> and <GLUE_DIR> arguments. I think platform/src is the correct glue dir, but I'm not sure what a glue spec is. I tried platform/main-glue.roc but got a complaint that it's a platform module, not an app module.

view this post on Zulip Luke Boswell (Feb 22 2024 at 22:31):

Oh I. have a branch glue-gen which includes a script for regenerating glue for the whole platform. The glue that is generated needs to be manually fixed up (by commenting out the invalid rust code). I should update that branch, maybe it is close to being mergable now

view this post on Zulip Luke Boswell (Feb 22 2024 at 22:33):

To answer your question you can run glue using roc glue ../roc/crates/glue/src/RustGlue.roc platform/src/ platform/main-glue.roc

view this post on Zulip Luke Boswell (Feb 22 2024 at 22:34):

If you change main-glue to just the type you want, then generate glue for that file somewhere. You can manually copy just the newly generated types for glue::Response::Timeout.


Last updated: Jul 05 2025 at 12:14 UTC