Stream: contributing

Topic: Dict.update


view this post on Zulip Chris Duncan (Oct 09 2022 at 15:30):

Should the Standard Library have a function similar to Elm's Dict.update?

view this post on Zulip Richard Feldman (Oct 09 2022 at 15:31):

yes! We were just talking about that in another thread, and I think there's an issue for it now

view this post on Zulip Chris Duncan (Oct 09 2022 at 15:39):

Excellent! :raised_hands:

I link them here for reference: GitHub Issue and Zulip Topic

view this post on Zulip Chris Duncan (Oct 09 2022 at 19:54):

I implemented the Dict.update function in this PR and I think it is fine. I followed the instructions to build from source yet when I run cargo run repl and try to use Dict.update, the REPL tells me that The Dict module does not expose update.

Not sure what I'm missing. Am I editing the wrong file?

view this post on Zulip Ayaz Hafiz (Oct 09 2022 at 20:08):

you’ll need to also add the symbol here: https://github.com/roc-lang/roc/blob/07ceabc9aa12c81792c33b98f7e45b9d05f903ca/crates/compiler/module/src/symbol.rs#L1413

view this post on Zulip Chris Duncan (Oct 09 2022 at 20:12):

Ayaz Hafiz said:

you’ll need to also add the symbol here: https://github.com/roc-lang/roc/blob/07ceabc9aa12c81792c33b98f7e45b9d05f903ca/crates/compiler/module/src/symbol.rs#L1413

What does this file do?

view this post on Zulip Ayaz Hafiz (Oct 09 2022 at 20:13):

We have to treat builtins differently in the compiler, so this file defines the symbols (definition names, type names, etc) used in the builtin modules.

view this post on Zulip Chris Duncan (Oct 09 2022 at 20:30):

It worked! Thanks!

view this post on Zulip Chris Duncan (Oct 09 2022 at 22:39):

PR ready: https://github.com/roc-lang/roc/pull/4273

view this post on Zulip Richard Feldman (Oct 09 2022 at 22:48):

nice! I'd suggest adding an expect test or two underneath it, just to verify it's working as expected :big_smile:

view this post on Zulip Richard Feldman (Oct 09 2022 at 22:49):

we don't have those for most of the stdlib because the stdlib existed way before expect did, but I'd like to start a trend of including those tests with the implementations!

view this post on Zulip Chris Duncan (Oct 10 2022 at 00:22):

Done

view this post on Zulip Chris Duncan (Oct 10 2022 at 10:37):

Now that the PR has merged, I see that the Standard Library docs are outdated. I must have missed a step somewhere or misunderstand Roc's processes since I expected that the comments I added to the function would be used there. I also see that the CI only runs roc test (through cargo run) on the Str module, so the tests I added are not contributing to the CI pipeline.

view this post on Zulip Anton (Oct 10 2022 at 11:23):

The website is deployed using the www branch, see the procedure here.

view this post on Zulip Anton (Oct 10 2022 at 11:26):

I also see that the CI only runs roc test (through cargo run) on the Str module...

Good catch! Can you update the step to include the other builtins?

view this post on Zulip Chris Duncan (Oct 10 2022 at 12:03):

Anton said:

The website is deployed using the www branch, see the procedure here.

The Standard Library is not found in that directory. Let me see if I can find it in the source code.

view this post on Zulip Anton (Oct 10 2022 at 12:33):

In case you haven't found it: https://github.com/roc-lang/roc/tree/main/crates/compiler/builtins/roc

view this post on Zulip Chris Duncan (Oct 10 2022 at 12:39):

Yup, I was able to generate the docs locally, and my changes appear there, so there must be something missing in the CD that deploys the website.

view this post on Zulip Anton (Oct 10 2022 at 12:47):

The procedure I linked earlier does not explicitly state that www is a branch.
So you need to do a PR against the www branch instead of the main branch to update the website.

view this post on Zulip Chris Duncan (Oct 10 2022 at 12:48):

I need better reading comprehension skills :rolling_on_the_floor_laughing:

view this post on Zulip Anton (Oct 10 2022 at 12:48):

Not sure why we set this up with the separate www branch to deploy but I suspect it's for good reason :)

view this post on Zulip Richard Feldman (Oct 10 2022 at 12:49):

yeah it's that we get a limited number of Netlify build minutes per month

view this post on Zulip Richard Feldman (Oct 10 2022 at 12:50):

so we want to only use them when we know we have relevant changes to deploy :big_smile:

view this post on Zulip Chris Duncan (Oct 10 2022 at 12:50):

That makes sense. Should I create a PR from main to www then?

view this post on Zulip Chris Duncan (Oct 10 2022 at 12:52):

I'm updating CONTRIBUTING.md with instructions on how to build the Standard Library docs locally. What is Roc's preferred local server? I used http-server, but I can imagine that we don't want to assume that contributors have node installed locally.

view this post on Zulip Anton (Oct 10 2022 at 12:53):

Chris Duncan said:

That makes sense. Should I create a PR from main to www then?

Yep that should be good

view this post on Zulip Anton (Oct 10 2022 at 12:54):

Chris Duncan said:

I'm updating CONTRIBUTING.md with instructions on how to build the Standard Library docs locally. What is Roc's preferred local server? I used http-server, but I can imagine that we don't want to assume that contributors have node installed locally.

We have a deploy preview for PRs to the www branch, so is it really necessary to build them locally?

view this post on Zulip Chris Duncan (Oct 10 2022 at 13:01):

Anton said:

We have a deploy preview for PRs to the www branch, so is it really necessary to build them locally?

If you don't want to clog or wait on the CI, yup.

view this post on Zulip Chris Duncan (Oct 10 2022 at 13:01):

Here's the PR to the www branch:
https://github.com/roc-lang/roc/pull/4282

view this post on Zulip Brendan Hansknecht (Oct 10 2022 at 14:12):

This also sounds like it may be a good use of weekly auto PR or something of that nature. Of course it would mean the docs have more lag, but it would not waist build minutes and would ensure they don't get forgotten.

view this post on Zulip Anton (Oct 10 2022 at 14:36):

@Richard Feldman would we have enough netlify build minutes for a weekly run?

view this post on Zulip Richard Feldman (Oct 10 2022 at 15:37):

apparently Netlify has an Open Source plan which gives you 25k build minutes per month (up from the current 300), as long as you put "powered by Netlify" on the homepage. So I'm gonna do that and apply for it! Then we can do nightly builds at the same time as generating the nightly binaries.

view this post on Zulip Brian Carroll (Oct 10 2022 at 22:17):

Oh that's great! I'm always forgetting to deploy things like web REPL fixes after merging to main! So will we keep the www branch but update it automatically? That way we can still do hot fixes if we break stuff.

view this post on Zulip Richard Feldman (Oct 10 2022 at 22:23):

that makes sense to me! :+1:

view this post on Zulip Richard Feldman (Oct 11 2022 at 01:56):

success! we've been approved

view this post on Zulip Richard Feldman (Oct 11 2022 at 01:57):

so now we can I guess just git reset --hard the www branch to main every night, and should be good?

view this post on Zulip Chris Duncan (Oct 11 2022 at 02:13):

How about just trigger the nightly cron job to deploy main and forget about the www branch?

view this post on Zulip Richard Feldman (Oct 11 2022 at 03:24):

this way we don't need Netlify credentials in GitHub, Netlify can just pull from the already-public GH repo

view this post on Zulip Chris Duncan (Oct 11 2022 at 03:27):

Though I thought that main is already public.

view this post on Zulip Richard Feldman (Oct 11 2022 at 05:36):

oh it is - just Netlify is set up to trigger on push to a particular branch, so if we set it to do that on main, it would deploy main on every PR merge

view this post on Zulip Anton (Oct 11 2022 at 05:49):

so now we can I guess just git reset --hard the www branch to main every night, and should be good?

I'll set up a workflow for that.

view this post on Zulip Chris Duncan (Oct 23 2022 at 12:40):

This latest commit should pass the CI
https://github.com/roc-lang/roc/pull/4289


Last updated: Jul 26 2025 at 12:14 UTC