Can someone kick of CI for #4387?
I think it needed roc format to be ran on the file, although I can't see any differences in the diff.
Running now
Should be good for a review and merge; passed CI.
Also can someone please kick off CI for the docs for Box.roc
and Dict.roc
4392? Thank you
I'll do a review first, that might save us some CI time :)
Can someone please look at these PRs? Please let me know if they need anything before we can merge them. :smiley:
general question, do expects in comments run with roc test
? If not, I think we should either fix that or not have expects in comments. That is just asking for them to get out of date with real implementation and expects in the file.
yeah I agree
I'd rather use expect
outside the docs, and then have the docs focus on looking as nice as possible
To confirm, you would like me to remove all the expects from the docs PRs here? This is an example of how it looks, I added it because I thought it helps to convey what the example means. Happy to remove and redo examples here and update PR.
Screen-Shot-2022-10-27-at-08.21.24.png
I agree that it looks great. I think that we either should make roc test
test doc comments, or we should we should add some expects right after the function and have docs generation grab them by default and add them.
I just think that they likely to become stale if they are docs alone.
Maybe there is a bigger story here. Should expects at document level be thought of as unit tests? Would it be helpful to have roc docs pull these in and show them separately? Instead of having code in comments, which mixes concerns, have a more natural way to capture intent. Can we have the expects have doc comments themselves? Then they get displayed in the docs, and we could refrrence them somehow in the doc comments for the function? This would also make it much nicer to have one test that shows multiple concepts. To reference an expectation in doc comments maybe you can use # title
or some kind of convention. I have been thinking about a similar need for doc comments to have headings and this would solve both of those use cases. I think a great doc experience is looking more like a document with really contextual code examples and interactive experiences.
Totally. I do think it is a bigger story. Where it lands, idk. Where it currently is definitely has problems.
Curious why I'm still seeing this when submitting a PR (https://github.com/roc-lang/roc/pull/4443)?
7 workflows awaiting approval
First-time contributors need a maintainer to approve running workflows. Learn more.
I have a "contributor" badge on that PR, and the last step that I _thought_ might be the case, was having a signed commit in the repo which I do as of my last PR.
It seems the detection system for "First time contributors" is a little wonky...
Joshua Warner said:
I have a "contributor" badge on that PR, and the last step that I _thought_ might be the case, was having a signed commit in the repo which I do as of my last PR.
It seems the detection system for "First time contributors" is a little wonky...
wow, I have no idea what's up with that...you now have write access to the repo, so lmk if it happens again!
Has anyone else had the same issue?
The message is wrong, this has nothing to do with being a first-time contributor. Only when you are explicitly granted write permission will you be able to start CI.
Here's a short PR to review.
https://github.com/roc-lang/roc/pull/4307
And another round of Rust Docs should be good for review #4462 :smiley:
Fixing a broken test I accidentally added: #4469. Whoops!
Thanks @Joshua Warner, I reviewed and merged it :)
Fixing test_mono again, after what I suspect is a race between two PRs: https://github.com/roc-lang/roc/pull/4471
@Richard Feldman
Got the table parser working without using HTML
https://github.com/roc-lang/roc/pull/4382
Some more parser refactoring and small bugfix, ready for review: https://github.com/roc-lang/roc/pull/4470
Rust docs PR 4462 is ready for review. Request further assistance adding more documentation here; so if you see something you would like added happy to take a message in chat or comment and I will update the docs. :smiley:
Luke's PR failed on apple silicon but there were no code changes:
---- cli_run::test_benchmarks::astar stdout ----
thread 'cli_run::test_benchmarks::astar' panicked at '`roc` command had unexpected stderr: An internal compiler expectation was broken.
This is definitely a compiler bug.
Please file an issue here: https://github.com/roc-lang/roc/issues/new/choose
thread 'main' panicked at 'failed to truncate shared file, are the permissions wrong?', crates/repl_expect/src/run.rs:64:17
stack backtrace:
0: _rust_begin_unwind
1: core::panicking::panic_fmt
2: roc_repl_expect::run::ExpectMemory::mmap_help
3: roc_cli::roc_dev_native
4: roc_cli::roc_run
5: roc_cli::build
6: roc::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
', crates/cli/tests/cli_run.rs:129:13
stack backtrace:
0: _rust_begin_unwind
1: core::panicking::panic_fmt
2: cli_run::cli_run::check_output_with_stdin
3: cli_run::cli_run::test_benchmarks::test_benchmark
4: core::ops::function::FnOnce::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- cli_run::test_benchmarks::base64 stdout ----
thread 'cli_run::test_benchmarks::base64' panicked at '`roc` command had unexpected stderr: An internal compiler expectation was broken.
This is definitely a compiler bug.
Please file an issue here: https://github.com/roc-lang/roc/issues/new/choose
thread 'main' panicked at 'failed to truncate shared file, are the permissions wrong?', crates/repl_expect/src/run.rs:64:17
stack backtrace:
0: _rust_begin_unwind
1: core::panicking::panic_fmt
2: roc_repl_expect::run::ExpectMemory::mmap_help
3: roc_cli::roc_dev_native
4: roc_cli::roc_run
5: roc_cli::build
6: roc::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
', crates/cli/tests/cli_run.rs:129:13
stack backtrace:
0: _rust_begin_unwind
1: core::panicking::panic_fmt
2: cli_run::cli_run::check_output_with_stdin
3: cli_run::cli_run::test_benchmarks::test_benchmark
4: core::ops::function::FnOnce::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
failures:
cli_run::test_benchmarks::astar
cli_run::test_benchmarks::base64
test result: FAILED. 38 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 232.76s
didn't this happen before when the disk was full?
That might be it, I'll check it out...
I have 46 GB available, I do expect that to be enough.
hmm, are they somehow fighting over the same file?
I bet the issue is in here somewhere https://github.com/roc-lang/roc/pull/4220
@Ayaz Hafiz found that you cannot truncate the same file twice on mac
so I guess that is what is happening? but then why did CI not catch that on that PR?
Could it be dependent on which cli_run tests run in parallel?
in theory, yes
though, do we run cli tests in roc dev
mode now?
No, it does not look like it
so how does it end up in replexpect
territory?
I'll check that out, does that mean it is trying to use the unfinished macos surgical linker?
no, this is not a linker thing
those tests do run “roc foo.roc” which is dev mode right?
Has that been recently changed to dev mode by default?
I believe so. Away from my computer right now though so might be wrong
but macOS libc behavior is sometimes suprinsingly subtle so definitely could be the problem
Yes, dev is the default:
let opt_level = if let BuildConfig::BuildAndRunIfNoErrors = config {
OptLevel::Development
}
matches.subcommand() {
None => {
if matches.is_present(ROC_FILE) {
build(
&matches,
BuildConfig::BuildAndRunIfNoErrors,
Triple::host(),
LinkType::Executable,
)
}
can you look at what the value of the CString
actually is in this case
fn mmap_help(cstring: std::ffi::CString, shm_flags: i32) -> Self {
let ptr = unsafe {
let shared_fd = libc::shm_open(cstring.as_ptr().cast(), shm_flags, 0o666);
if shared_fd == -1 {
internal_error!("failed to shm_open fd");
}
// NOTE: we can only call `ftruncate` once on this file descriptor on mac
if libc::ftruncate(shared_fd, Self::SHM_SIZE as _) == -1 {
internal_error!("failed to truncate shared file, are the permissions wrong?");
}
I suspect the same name is used multiple times
so maybe we need to explicitly close the file descriptor?
I've checked it on the CI machine when the error occurs and the printed cstrings do not have any duplicates.
hmm, maybe printing https://doc.rust-lang.org/std/io/struct.Error.html#method.last_os_error in the branch that panics?
may tell us a bit more
The last os error is always:
code: 35
kind: WouldBlock
message:"Resource temporarily unavailable"
This also shows up when doing successful cli_run
tests but then again this error may stem from a previous run that did fail or be from something else entirely...
yeah based on https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/ftruncate.2.html ftruncate
does not cause that
I'm going to do a bisect
The first bad commit is Resolve ability specializations looked up in expects.
is it really? I'd guess it just straight up didn't work before that commit
It's probably actually https://github.com/roc-lang/roc/pull/4220/commits/c5cdab1ff9bd7305d4a0d4a2569224ad302e9733
yes but why?
why was this done? https://github.com/roc-lang/roc/pull/4220/commits/84178c66e1a026cb431193935f66877e8e90226e
That might be the problem, because if we reuse the file descriptor that will truncate again
Right, that is the problem, because we call mmap_help
before and after the fork
nvm that is wrong, I was looking at a code path not reachable today (expect-fx)
In any case, if we end up reusing the shm path that will cause a problem. I still think that commit should be reverted
the path that we open includes the process id
of the parent, but that should just be unique
unless it isn't I guess, then I'd prefer that we shm_unlink
at the end
does the zig side resize it?
no, this is the code (expect.zig)
const shared_fd = roc_shm_open(@ptrCast(*const i8, &name), O_RDWR | O_CREAT, 0o666);
const length = 4096;
const shared_ptr = roc_mmap(
null,
length,
PROT_WRITE,
MAP_SHARED,
shared_fd,
0,
);
const ptr = @ptrCast([*]u8, shared_ptr);
return ptr;
hmm. maybe CI does recycle pids?
then Anton should have observed repeated CStrings, which did not happen
I missed that message, my bad
Folkert de Vries said:
is it really? I'd guess it just straight up didn't work before that commit
While that was the outcome of the bisect, the truncate error does indeed occur in commits before that.
I was basing myself on nightly apple silicon tests to see how many days I should go back but that recently merged PR has some old commits in it which is why my approach was wrong. This event does make me doubt our merge strategy.
Anyway I'll get onto finding the right commit after walking my dog :)
Now thoroughly checked; move around some libc code is the first bad commit.
that's weird. That means a file descriptor is re-used. Maybe it is between runs somehow
well we can revert that commit (in spirit, that memset at the bottom should stay)
Fix confirmed, thanks @Folkert de Vries :) I'll set up a PR.
I have a few PRs that are ready for review / merging:
I have a pretty large PR that's more or less ready, here: https://github.com/roc-lang/roc/pull/4716
That fixes up the parser fuzzer and fixes a bunch of bugs that fell out.
If someone's up for reviewing as is, great. Otherwise I'm happy to break it into a few smaller PRs for the individual bug fixes.
One of the changes that I'm kinda conflicted about is removing the SSE optimizations for quickly skipping past spaces/comments. I have some local changes to do some re-optimization of those routines - for now in a platform-neutral way that doesn't actually require SIMD at all!
On my M1 mac, the new version is ~25% faster at parsing Num.roc
than the current (main
) code is - but that's not apples-to-apples, since nobody wrote NEON optimizations for arm.
Actually...
Huh
Running the new optimizationed version on my x86_64 linux box also shows it being a net win relative to the SIMD version, which doesn't make a whole lot of sense.
New plan: going to clean up my parser benchmarking fixes, put a PR out for that, and then maybe a few folks can try to repro my numbers.
The new code is in this branch: https://github.com/roc-lang/roc/tree/faster-spaces-experiment
Benchmark fix here: https://github.com/roc-lang/roc/pull/4730
Going to fold in the faster spaces improvements into the fuzzing PR, so (I think?) we won't have a net perf regression
so, what should we run to benchmark?
Check out the current main
, then cd crates/compiler/parse/
, then run the benchmarks:
env RUSTFLAGS='-C target-cpu=native' cargo bench --bench bench_parse -- --save-baseline main
After that, check out my PR with: git fetch origin pull/4716/head:josh-swar-update; git checkout josh-swar-update
, and run the benchmarks again with:
env RUSTFLAGS='-C target-cpu=native' cargo bench --bench bench_parse -- --baseline main
Fuzzing the formatter is (finally) ready for review again: https://github.com/roc-lang/roc/pull/4758
Looking for quick review here: https://github.com/roc-lang/roc/pull/4820
(This was previously approved, but it turns out I had forgotten to sign the commit)
Request someone review and kickoff CI for PR5052. It should be minor as it is only markdown updates for the tutorial. Thanks :smiley:
Can someone kick-off CI for #5051? I just squished the commit that wasn't signed, and merged latest main.
I've drafted #5077 [WIP] to add support for escapes in the JSON decoder. I've got a few questions and would appreciate some guidance or assistance.
Additional Q: does my Roc test even cover escapes correctly? It's a bit murky with all the conversions between utf8, looking for ideas to do this better.
#5076 is ready for review and a pretty small PR. It just causes a ton of mono tests to be updated. Fundamentally, the real changes are just in List.roc.
#5077 is ready for review. I've added a few more tests and fixed some decoding bugs/todos for JSON. This implementation is less strict with whitespace than the spec I'm referencing describes, but this feels more reliable than crashing. We could add more Error tags to handle these cases instead, but feels ok to just continue and parse the input.
@Ayaz Hafiz why do the tests fail for ^^^? Are the internal tests for Abilities hardcoded somehow?
The failing tests are for mono, that is expected. Whenever builtins change, mono changes.
Just run the mono tests in release build and then add the updated files
btw you don’t need to run them in release mode anymore
It looks like the new json encoder hits an issue with the surgical linker. So it is breaking the ruby interop test
Probably can set the test to use the legacy linker only and file a bug for this.
Oh, actaully, I think it is a simple bug
Just need to add roc_memmov
to the platform for ruby interop.
Found a discrepancy in the docs for List.splitFirst
and List.splitLast
: https://github.com/roc-lang/roc/pull/5108
I have a PR for Json which is ready for review 5163. Somehow CI was cancelled at the final hour, Im not sure how, maybe it timed out?
yeah looks like a timeout - they appear every so often. I've kicked it off again
Looks like cli_run::parse_letter_counts
or cli_run::parse_movies_csv
got stuck
Can someone please review 5163 for me?
This PR now includes the Number and String primitives, and List decoding that comply with RFC 8259. I'm hoping it passes all of CI on this run. A review and some feedback would be most appreciated before I commit too much further down this path.
I added a number of tests to catch different edge cases, and confirm decoders function correctly, including the composition of Lists with Numbers and Strings.
I added a number of TODO's to highlight out areas for future work. Some additional notes;
@Ayaz Hafiz suggested I make a custom result type so I can ship the Tcp
module for basic-cli
.
After some glue
trickery, here it is: https://github.com/roc-lang/basic-cli/pull/29
Thanks @Ayaz Hafiz for all the help with glue :heart:
@Agus Zubiaga FYI https://github.com/roc-lang/roc/pull/5248 should fix glue generation for Result
once it lands!
Ooh perfect!
I see the tests return Result
from main
but does this also fix returning RocResult
from roc_fx
functions in the platform?
nothing changed there (in that PR, anyway).
what is the problem there? if you want to send a Result a []
value from rust to roc, you can just pretend that it is an a
value on the rust side
Right. However, last time I tried this, Roc would always think Ok
s were Err
s.
I mean in cases where the error type variable is not []
hmm, ok
I'll have to test some more with that result type then
iirc, the issue is that rust takes the two u8s and densely packs them into 1 u16.
So we expect 2 registers to be used, but rust compresses even more and that breaks our generic roc result layout for anything smaller than a u16
Request a review for basic-cli#32 which adds a Time.now
function which returns milliseconds since UNIX EPOCH using std::time::SystemTime
.
I opened a small PR to make an example more clear: https://github.com/roc-lang/roc/pull/5267
This confused me a bit and I thought it might prevent more confusion in the future.
Looking for feedback on roc-lang/examples#14 which adds an example for Graph Traversal, specifically Breadth First Search, and Depth First Search using an adjacency list representation. Thank you
I uploaded a copy to github pages if anyone would like to see it rendered which might be easier. now outdated, see PR for latest version
I think I may have messed up the implementation of BFS by using a stack instead of a queue, but I'm not sure. All nits welcome.
I think your "stack" in bfs is a queue. You always load the first element in the list and you always add the new elements to the end of the list. So FIFO instead of LIFO.
In dfs it is a stack because you put the new elements at the beginning and load from the beginning. That said, it is also the slow version of a stack. You really want to use the other end of the list. Put the new elements at the end and load from the end.
Thanks brendan, I updated the PR.
Small docs issue: https://github.com/roc-lang/roc/pull/5342
Record Builder syntax: https://github.com/roc-lang/roc/pull/5389
Context: https://roc.zulipchat.com/#narrow/stream/316715-contributing/topic/Record.20Builder.20Syntax
Json updates https://github.com/roc-lang/roc/pull/5163 now passes CI :tada:
And a follow-up to bump the basic-cli version and improve Json for Examples https://github.com/roc-lang/examples/pull/28
I think that CI is held up because the latest roc nightly doesn't yet have the Json update in it. It will just need to be restarted sometime tomorrow. All tests pass locally for me.
nice! Do you have thoughts on pulling out Json
into its own standalone package at this point?
instead of having it in builtins
e.g. github.com/roc-lang/json
That's the plan. I'm happy to build it into a package, I've basically already done that. I thought @Ayaz Hafiz had some things that needed to be updated internally so that it can be removed from builtins. It doesn't work well as a package right now as the name conflicts, so I usually rename it to Jason when I use it.
Yeah we need to address https://github.com/roc-lang/roc/issues/5373 first
nice! @Luke Boswell do you think you'd be able to tackle that issue?
Prevents Record Builder fields from shadowing other symbols: https://github.com/roc-lang/roc/pull/5415
New Record Builder field syntax (context): https://github.com/roc-lang/roc/pull/5421
PR #5488 to remove Json from builtins has passed CI, request a review please :smile:
Scope of the change is just to change the name of Json builtin, but that touches a lot of tests and other files.
merged, thanks!
Added Task.batch
in #45 with an example for CI to basic-cli
and it should be ready for review.
Also updated #28 which adds modules to exports so that Docs gen works correctly for basic-cli
. There appears to have been a flaky test in the past, but it seems to be working well now. I updated to include recently added modules.
oh wow, awesome - reviewed and approved!
Does this mean we can finally re-enable basic-cli docs generation and deployment as part of our roc-lang.org
builds? :smiley:
I think so, but @Anton will be interested in this.
Ok, so I started adding some minor fixes, which snowballed into PR #46 for basic-cli
. Visual fixes fro generated html docs across various modules, and starting content for Task
module. Might stop here before this gets too big.
Amazing @Luke Boswell :)
I know I said I would stop here above, but I've got a few hours today so I might just keep going on basic-cli
docs updates. I'll just keep working on the same PR.
I think I'm done with #46 for now. Completed multiple passes and cleaned a lot of things up. I might have a stab at fixing the types for docs gen over in roc-lang/roc
so I will leave this for now. Ready for a review. Apologies for such a massive PR, it's just easier to do all these minor changes in one go.
Along with the above also some fixes for docs gen in PR #5537 ;
I've submitted a PR #48 which adds a Utc.sleepMillis
effect for basic-cli
. I probably should have raised this as an Idea first, but I needed it for another thing I'm working on and it was simple to implement.
And another PR #49 to add Stdin.byte
for basic-cli
to read a single byte at a time.
Hi! Here is my first PR #5549. Just a couple of docs example for the List builtin. Checked the generated html and it looked Ok.
Awesome @Norbert Hajagos, I'll take a look
PR #53 for basic-cli
changes main to Task {} U32
is ready for review
PR #55 for basic-cli
adds a new Command module which enables running commands like ls -al
or FOO=BAR env -v
using roc. Thank you
For ^^^ I'm not sure what the status of this is. I see @Ayaz Hafiz approved it but GH still has the PR as requiring an approving review. Can someone please have a quick look and see if there is anything outstanding?
I dunno, but merged!
Two PR's that are ready for review
@Folkert de Vries are you able to review these?
I don't have commit rights for that repo. maybe @Brendan Hansknecht or @Ayaz Hafiz do?
approved :approved:
Luke Boswell said:
Two PR's that are ready for review
- #66 update
Process.exit
to I32
oh, I missed this - actually part of the motivation of the change to have main
return an exit code was to remove Process.exit
:big_smile:
So you could just return Task.err -1
etc... I guess Process.exit -1
is clearer. Would you like me to remove it?
yeah let's remove it! :thumbs_up:
PR #68 to remove Process
module from basic-cli
@Folkert de Vries you now have commit rights to basic-cli
#5694 is a draft PR that fixes (workarounds) for zig builtins tests on Windows. Request a review and some feedback.
Thanks @Luke Boswell :)
I'll take a look today
I can take a look at the test failures, but someone with actual zig experience should probably look at the zig code :p
Oh yeah, I haven't bothered with the test failures. It looks like clippy/fmt etc
#92 is a PR to rename the Command module to Cmd in basic-cli, and change the functionality of the Cmd.output
.
I'll check it out :)
PR #97 add new features for basic-cli to the Directory module, essentially mkdir
mkdir -p
rmdir
rm -rf
.
Failures on #5741 seem unrelated to this change, is it worth re-running do you think?
re-ran :thumbs_up:
Is the failure on 5780 a flake?
I think so, re-running now
merged :)
#5802 makes some simple HTML & JS changes to the REPL page on the website. Just fixing a line-wrapping issue.
I'd appreciate a review because I am preparing slides for my talk about the web REPL and it would be nice to have screenshots that are not from localhost!
done
Thanks Folkert!
CI failure on #5858 is a flake; worth re-running?
---- cli_run::hello_world_no_url stdout ----
thread 'cli_run::hello_world_no_url' panicked at '
error: test failed, to rerun pass `-p roc_cli --test cli_run`
___________
The roc command:
"/home/small-ci-user/actions-runner/_work/roc/roc/target/release/roc --max-threads=1 /home/small-ci-user/actions-runner/_work/roc/roc/examples/helloWorldNoURL.roc --"
had unexpected stderr:
🔨 Rebuilding platform...
thread 'main' panicked at 'range start index 109041880 out of range for slice of length 99054856', crates/linker/src/elf.rs:1268:18
Yeah re-running is fine, we don't want to get in the habit of skipping tests
Allow where
to be used as an identifier: https://github.com/roc-lang/roc/pull/5869
Tiny fix for the web REPL JS. Not crucial, just makes the code clearer. https://github.com/roc-lang/roc/pull/5873
Added List.chunksOf
as a builtin https://github.com/roc-lang/roc/pull/5893
Thanks @Elias Mulhall :) I'll take a look
@Richard Feldman roc-lang/unicode #1 - added the basic infrastructure and cleaned up some things so it at least compile and tests pass. Added a basic example.
Hi folks, I opened a PR to add Str.contains
https://github.com/roc-lang/roc/pull/5905
I have added #95 to roc-lang/examples
which provides a demonstration and explanation for how to use the record builder pattern. @Agus Zubiaga could you please review this for me?
I have also pushed a copy of the page to here which includes syntax highlighting etc as I find that easier to read.
https://github.com/roc-lang/examples/pull/95 updated with @Agus Zubiaga feedback, and should be ready for approving. @Anton are you able to assist here?
Yes :) I'll look at it in a bit
@Luke Boswell I approved it!
Thank you Agus, I can see that. Unfortunately it looks like we still need someone else to approve it before we can merge :sad:
I'm making some edits now...
Add text segmentation for extended grapheme clusters - part 1 is ready at roc-lang/unicode #2
Added roc-lang/unicode #3 to actually implement the text segmentation for Grapheme's. It covers most sequences correctly, but not Emoji :cry: or Flags :flag_australia:, or combinations of Indic_Conjunct_Break
(which I have no idea how to do yet).
Current progress agains the unicode test suite is 328 failed and 912 passed in 4548 ms.
.
How do you intend for flags to work? Because they are, by design, not single symbols in unicode. As far are the consortium is concerned they don't want to bake things as fickle as flags into permanent standards, so the way it's implemented is conceptually closer to a ligature. At least, last I checked. Do you want to count flags as one grapheme, or the several symbols that encode it? Like the later is less intuitive, but it's unintuitiveness is directly tied to the intent and function.
Basically don't break within two Regional Indicator symbols. This is the text segmentation algorithm https://unicode.org/reports/tr29/#Grapheme_Cluster_Boundary_Rules. See here for more detail https://www.unicode.org/reports/tr51/#Flags
That said, I haven't spent any time on implementing that. I've spent a couple hours on emoji sequences, which looked straightforward, but turns out I don't really understand the notation they are using in the standard. So when I plugged the test cases back into my state machine I am getting incorrect results.
I didn't know there was a standard it. I guess it makes perfect sense that they'd give a guide to something like that.
And yeah, that sounds like a massive pain to implement.
Hi folks, I just opened up a PR to make List.dropFirst and List.dropLast accept the number of elements to be dropped https://github.com/roc-lang/roc/pull/5941.
Related to this thread https://roc.zulipchat.com/#narrow/stream/304641-ideas/topic/Drop.20n.20elements.20from.20the.20end.20of.20a.20list
Thanks @Isaac Van Doren! I'll do the review
Just opened a pr to change the type of Stdin.line to Task [Input Str, End] *. Looking forward to this so I can pipe input into programs :big_smile:. https://github.com/roc-lang/basic-cli/pull/114
Thanks @Isaac Van Doren :)
I'll take a look later today
Two simple PRs for review: #5955 and #5956
Approved, looks like the first has CI failures
Apparently using the Github UI to rebase a branch ends up removing commit verification...that's annoying
#5978 rust glue generation changes to fix closures.
We have a web server that compiles and runs now :tada: https://github.com/roc-lang/basic-webserver/pull/2
@Brendan Hansknecht's workaround is required for now whenever re-generating glue. There is still a lot of polish required to make this more user friendly, but at least it serves requests.
I think this is pretty cool... added the Command effect and an example which reads todos from an SQLite3 database and then send a JSON encoded response. :smiley:
Screenshot-2023-11-14-at-17.23.39.png
Screenshot-2023-11-14-at-17.23.47.png
Definitely getting carried away over here... it's very quick an easy to add new features.
yoooooooo :heart_eyes: :heart_eyes: :heart_eyes: :heart_eyes: :heart_eyes:
amazing work, @Luke Boswell @Brendan Hansknecht!!!
I copied the TCP implementation I did for basic-cli to basic-webserver: https://github.com/roc-lang/basic-webserver/pull/4
This unblocks us from trying things like roc-pg on top of it. However, in the long term, the API should look a little different, including the ability to maintain TCP connections across requests and potentially some pooling primitives.
yeah I have some ideas about a pooling API design! We should chat about that at some point, make sure they'd be a good fit for roc-pg
@Luke Boswell is probably the best person to review this one!
Super simple review, just adding a few trait to RocResult such that it has them when needed in glue generation: #5986
#5989 adds a Table of Contents for the WIP Tutorial page.
^^ also formats some css as I ran Prettier on the file.
basic-webserver#5 Updates the README and improves the examples making them more beginner friendly, cleaner, with improved error handling
Also @Richard Feldman Im not sure if you wanted anything in that main.roc example, so I've just left it and the comments for now. It looks like your doing something with secrets or tokens.
https://github.com/roc-lang/basic-cli/pull/132
basic-webserver#8 is ready for review. It's a pretty massive improvement and should make the platform significantly more capable.
21k lines of diff, wow. How much of that is generated code that doesn't need review?
Shouldnt be too much. Almost all of those lines are probably the generated glue.
@Agus Zubiaga do you have any examples with roc-pg
? I don't have a great way to test the Tcp
module.
I added the types for Tcp
to platform/main-manual-glue.roc
so they are (re)generated the same as all the others, and am 99% confident this will not have broken anything as the changes to glue since you generated that tcp_glue.rs
were very minor.
@Anton @Brian Carroll would either of you mind looking through the PR for me?
I modified the way glue is generated so that the one script platform/glue-gen.sh
will generate it all.
There are two parts to glue because glue only generates for some of the types, so I added platform/main-manual-glue.roc
which I've called the crate glue_manual
and use that to generate the missing types
If you re-generate glue there are a few issues that have to be manually fixed by hand, I logged https://github.com/roc-lang/roc/issues/6012 to capture those.
OK I can have a look but I'm going to need your help to narrow down which files are actually to be reviewed! 22k lines is not realistic for a person to look at. Could you spell that out for us?
I'll go through an make a bunch of comments in the PR
platform/src/lib.rs
and the examples are the places to focus.
And almost all of that lib.rs
file is copied from basic-cli
and updated to point to the correct glue types.
Luke Boswell said:
Agus Zubiaga do you have any examples with
roc-pg
? I don't have a great way to test theTcp
module.
I gave a demo at work the other day using roc-pg + basic-webserver and it worked great. I can’t upload that example because it used our real db, but when I’m back home from a trip tomorrow, I’ll make a public one.
I made some updates to the examples repo:
This was prompted by a conversation at the end of the meeting yesterday, where I mentioned that a few of the examples seemed a bit rough/confusing.
#6034 should be ready to review. It just deletes the old copy of basic-cli from the roc repo and updates all of the examples to use the basic-cli platform via url. I copied over an version of each example from the basic-cli repo to update them. I also added roc check
tests to each file that doesn't have a full test to avoid them going stale. Overall, it is a pretty direct PR mostly deleting things.
#6030 should now also be ready for review.
It does 2 main things:
.. as rest
syntax (just a call to List.sublist
).[1, ..]
and [.., 1]
is not considered a redundant pattern.basic-cli#136 implements Dir.list
effect
Yay
I've kicked of CI for #6054, it looks good to me but I am not familiar with this part of the code base. It's a very small change.
#6061 replaces the stale webserver implementation in examples with two example that point to roc-lang/basic-webserver
URL package
Thanks @Luke Boswell :)
I'll review basic-cli#136 and #6061
Just a random GH related question, not necessarily specific to this PR or anything. What is should be the process for when we get a PR to this stage?
It's been reviewed, I've made changes and pushed those. I clicked "resolve conversation" on the individual comments. Should I "Dismiss Review" or "Re-request Review" now?
I would normally just chill here and wait for Anton or someone to re-review and merge the changes. But just interested in how the GH workflow is designed to work.
Screenshot-2023-11-23-at-09.07.28.png
I've wondered the same thing :big_smile:
At my last job where we used gh we would generally re-request review once it was in a good state to be looked at again
PR#6068 adds a section for Abilities to the roc Language Reference
PR#6072 updates the @
token from a Keyword/Punctuation to an UpperIdent token for correct styling syntax highlighting.
examples PR#112 updates the Task example. I've updated to use the new 0.6.1 release. I think @Anton would also like to review this.
PR#6099 fixes a couple issues by desugaring patterns during canonicalization.
This is my first(!) time writing rust code in anger. I think it turned out alright, but if anyone has time for feedback I'd appreciate it.
I left you a couple comments Elias, they're non-blocking and can be addressed later
https://github.com/roc-lang/roc/pull/6108 fixes me mixing up the captures and the actual argument to List.map
examples#115 renames Task
example to Task & Error Handling
to improve discoverability. Super skinny PR.
Thank you Brendan, you don't have privileges on Examples. @Folkert de Vries are you able to approve?
#6123 fixes css class for error color in REPL on homepage.
#6124 prevents spellcheck in web REPL text area
it's soooo nice that these changes don't have to run the entire CI suite now
thanks for making that happen, Anton! :heart_eyes:
Yeah, it's really great. I don't feel the need to bunch all these minor changes into a massive PR to save on CI.
#6126 adds a link to roc-lang/roc to the website footer.
Easy review, just +14. The entire change is to ignore the seamless slice bit when calculating the length (that and a test case). So we don't see gigantic incorrect numbers for string length: #6158
Easy review, just fixing an off by one error: #6166
New PR just dropped: #6186
keepIf
and dropIf
for Set
and Dict
. Please check if safe and optimal
#6184 is now passing tests fully.
It fixes our debug info generation (I think we still only generate on the function level, but better than nothing). Changes some of our flags as mentioned in #ideas > Optimize, but only a little, and removes debugir. It has been broken for a while and we now are able to generate real debug info. We should focus on improving our debug info instead of falling back on the debug ir crutch.
that's only partially true: debugir is useful when the problem is in the code we generate, or when LLVM does something weird
and it's broken because of the llvm upgrade right? that can be fixed
and it's broken because of the llvm upgrade right?
Yes, debugIR needs to be upgraded to llvm 16. There are some breaking changes in llvm 16 that no longer allow the use of getPointerElementType
. To record and share knowledge; here are the migration instructions. The migration is not straight forward. C++ experience is recommended.
@Oskar Hahn ostcar/roc-wasi PR#1 - adds an Effect implementation for opening a file using WASI. It's probably not the greatest but it works, and I hope can be an example for how to implement other effects in zig platforms. Also thank you @Folkert de Vries for helping with a zig RocResult
.
#6176 was already reviewed and just needs approval to be merged. I had to rebase to fix a CI issue which is why the old review got dismissed.
#6202 Single function PR. Changes the Str substring builtin to use seamless slices. Noticed a program I wrote spent 98% of its time in memcpy before this.
#6210 add plans to remove Nat
to the website.
Full rewrite of the underlying Dict
implementation. 1.5x to 3x faster in my testing: #6216
yessssssss I love this!!!
#6228 handle a TrailingOperator parse error. I wasn't sure of the difference between Severity::RuntimeError
or Severity::Fatal
so I chose the former as that sounds less scary.
#6134 Support for completion in the language server is ready for some reviewing. It's got some pretty major changes and is the first rust I've written in a long time so I'd love some input :)
Thanks for doing this. I’ll take a look at it tonight.
https://github.com/roc-lang/roc/pull/6232 makes it possible to create seamless slices from rust. This is useful for nea.
#6238 small change just adds a function to dict and fixes some small follow up suggestions form the last pr. (mostly uitest and mono test updates)
#6249 Another small PR. This just renames some things in the bitcode to help with clarity.
https://github.com/roc-lang/roc/pull/6146
no rush but could someone kick off tests for this? Trying to see if i can get the mac nix setup to work with the new nixpkgs
#6256 - fixes Dict.update
#6258 - Adds List.walkWithIndexUntil
to builtins
(Still waiting for CI to finish, but I need to sleep)
#6257 - Replace UNKNOWN.roc in reports with real filename
I have created a PR for roc-examples repo, please review it and there's a issue that I want to work on but that's already assigned to someone and that assigned person isn't responding, should I start working and create a PR???
https://github.com/roc-lang/roc/pull/6281 updated some of the docs for installing with nix + fixed nix run github:roc-lang/roc
Thanks @John Murray :) I'll try to review today.
Thanks for the PR @Sahil! I'll try to review today.
Can you provide a link to the issue where the person was not responding?
Anton said:
Thanks for the PR Sahil! I'll try to review today.
Can you provide a link to the issue where the person was not responding?
https://github.com/roc-lang/roc/issues/6260
oranjan was only assigned two days ago, let's give them two more days to reply :)
The examples repo has a bunch of approachable good first issues if you're on the hunt :wink:
Yep just waiting for the first approval on the examples repo as that'll help me realize if I'm going in the right way or not, looking forward to contribue to examples repo and I'll update you after couple of days if there's no response,thanks :grinning_face_with_smiling_eyes:
#6286 Adds a Num.restrictToInterval
function (clamp in other languages)
Thanks @Kilian Vounckx! I'll review today
No rush, just informing that I have made the required changes for this issue, https://github.com/roc-lang/roc/issues/6260
I'm on it :)
Thanks
unicode PR #3 implements the text segmentation algorithm for legacy grapheme clusters. This PR is very large. @Richard Feldman if you would like I can arrange a time to talk you through the implementation, I've tried my best to leave comments and lots and lots of tests everywhere.
Anyway all that work means we can now do this :tada:
291053423-5444a941-41a7-4fd3-9102-fcd63e8cda8d.png
And I have to share this part of the internal implementation for anyone who is interested in how complicated it is to segment unicode, after you have parsed into grapheme property break tokens.
This took me a quite while to implement, and it probably needs some more testing against real data before I can be confident it is close to correct, there are so many edge cases and the test suite is missing a lot.
Also, if there is anyway to fuzz test this I feel like that would be super helpful.
It's probably stale and needs to be upgraded, but I made a platform for fuzzing roc code a while back
PR to display shadowing error messages last in the CLI https://github.com/roc-lang/roc/pull/6344
PR to fix the language server and compiler hangs from bad imports https://github.com/roc-lang/roc/pull/6361
wow, amazing!!! :heart_eyes:
This has been a very longstanding bug!
Richard Feldman said:
wow, amazing!!! :heart_eyes:
This has been a very longstanding bug!
Look... I spoke a little too soon on that one :sweat_smile: . I "fixed" it by forgetting that interfaces need to be able to import from external packages too. But I can sort that out in a minute.
Well, it's definitely going to be more than a minute. I know whats wrong at least, but it's going to be a while to get a solution that fixes it for interfaces. See here https://roc.zulipchat.com/#narrow/stream/316715-contributing/topic/Fixing.20hanging.20due.20to.20incorrect.2Funknown.20shorthands
#6363 fixes for bugged setjmp/longjmp on windows/llvm
basic-cli #156 add Task.list and Task.forEach
#6384 Adds --ignore-warnings
flag to roc check
and roc build
#6329 allows the embedding of code snippets in markdown files during static site generation.
#6242 prevents roc format
from reading the current working directory if the --stdin
or --stdout
option is present on the command line.
#6134 Support for completion in the language server Is ready for another round of review. I've even got my commit signed. Thanks to @Luke Boswell for pointing that one out :)
I'll kick off CI
I have a handful of really small PRs that could use quick reviews:
#6474
#6477
#6478
Also this one, but it is windows specific. So want someone who runs roc on windows to make sure I didn't regress anything. I just changed something to match the windows call conv docs:
#6475
I can look at windows, but might take a day to get to it. Work is busy this week.
https://github.com/roc-lang/roc/pull/6481 a fix for inline expects that are hit by a top-level expect
#6503 is a fix and new test for generating stub lib for macho. It's my first attempt at something for the macos surgical linker.
Does anyone have any ideas what might be causing this issue in CI? I've done some research and I thought it might be intermittent, but I re-ran CI and it popped up again. Specifically the AccessDenied
looks to be caused by call zig build-lib
on Windows, and I suspect it may be related to using a temporary file.
---- generate_dylib::tests::check_exports_macho stdout ----
thread 'generate_dylib::tests::check_exports_macho' panicked at 'Failed to link dummy shared library - stderr of the `zig build-lib` command was:
error: AccessDenied
', crates\linker\src\generate_dylib\macho.rs:70:27
isn't this what we often hit on windows and we just need to run the same command again?
Yeah thats what I thought so I restarted it... maybe I should try that again?
I just didnt want to waste CI
well but restarting CI will start from a clean slate right?
I did some searching and I've encountered an AccessDenied from zig in the past and I was able to fix it by setting the env var XDG_CACHE_HOME = "xdg_cache". This was with nix, so not on windows but it may work...
My first PR here!
https://github.com/roc-lang/roc/pull/6506
It. adds checks for files extensions. Feel free to let me know what I could do bette in this
Thanks @Trevor Settles, I'll take a look :)
Thanks for your feedback, @Anton! #6506 is ready for another review
Hey folks, is there anything more I should do to get this merged?
https://github.com/roc-lang/roc/pull/6134
@Ayaz Hafiz has approved (thanks heaps for all the review :) ). I'm just not sure if there is anything else I should be doing.
Oh, can you hit merge?
Or is that not available??
Done, nice work on this. I look forward to using it.
Luke Boswell said:
Oh, can you hit merge?
Oh, maybe I could have? I don't think so though.
Either way thanks :). I'll rebase the next pr for module and import conpletion and get that ready soon too.
basic-webserver #35 adds basic support for Sqlite3.
The key thing here I am unsure about is how the connections are managed wrt multiple threads. I tried to do something that looked ok from some research and asking ChatGPT, but I've not done multithreaded Rust before so that might be all completely wrong or overkill.
Should be able to make it a thread local and have one per thread automatically
That said, if it is async, might be more complicated.
My solution was basically this
struct SQLiteConnection {
path: String,
connection: std::sync::Arc<sqlite::Connection>,
}
static INIT_GLOBAL_CONNECTION_STORE: std::sync::Once = std::sync::Once::new();
static mut GLOBAL_SQLITE_CONNECTIONS: *mut std::sync::Mutex<Vec<SQLiteConnection>> =
std::ptr::null_mut();
fn get_connection(path: &str) -> Result<std::sync::Arc<sqlite::Connection>, sqlite::Error> { //...
Maybe a bit defensive, but probably safer.
This PR for module completion is ready for review :https://github.com/roc-lang/roc/pull/6347
This pr makes roc build --lib
respect --output
https://github.com/roc-lang/roc/pull/6523
My first PR
https://github.com/roc-lang/roc/pull/6524
I think I understood the site.css right.
There was another PR that was fixing the same issue. I am sorry if I overtook it
https://github.com/roc-lang/roc/pull/6526
This adds sorting to the functions mentioned in https://github.com/roc-lang/roc/issues/6494
I am not 100% about the search button layout, I had to resort to margin pushing. Maybe the search button can be simplified?
Thanks @Gunnar Ahlberg, I'll try to review today :)
https://github.com/roc-lang/roc/pull/6422 is finally ready...it's kind of a beast, so I don't expect anyone to do a super thorough review of it, but I'd love it if anyone could glance through it and see if they spot anything concerning!
the Zig changes in particular would be nice to have reviewed - they're a pretty small part of it, but they're the changes most likely to impact edge cases that don't have explicit tests (e.g. when numbers are so big they might overflow)
also would be good to test some of the wasm4 games and see what impact it has (if any) on the generated wasm code!
I can test out wasm4 later
nice, thank you!
Looks to be working fine with wasm4 on my roc-wasm4/remove-nat
branch.
The only issue I have found is that the ZigGlue.roc has a few MODULE NOT IMPORTED in crates/glue/src/../platform/Types.roc
warnings which prevent me from regenerating glue for wasm4. This looks to be an unrelated bug to the remove nat changes.
basic-webserver #41 simplifies Request API and adds Http.parseFormUrlEncoded
helper. These are some changes I've been using locally and wanted to share for others as they are helpful when building a web app.
#6533 was contributed by roc-gpt, and ready for human review.
I'll clean it up a bit, it's not quite right... but I thought it was an interesting idea.
basic-cli#175 change Http.send
to return Http.Response
instead of Str
. Feature requested by @Marten
Hey, this has been waiting for review for quite a while now, I'm working on another PR on top of it and it'd be nice to be able to merge it in if it's considered good
https://github.com/roc-lang/roc/pull/6347
I kicked of CI, I'm probably not qualified to provide a review and approve though.
This PR adding docs for completion is also ready for review and builds atop the previous one adding completions for modules and imports.
https://github.com/roc-lang/roc/pull/6569
Hey, this has been waiting for review for quite a while now
I'll try to look at it tomorrow if no one else is available
This PR for optional record field decoding is ready for some general review:
https://github.com/roc-lang/roc/pull/6587
I also made a thread for it: https://roc.zulipchat.com/#narrow/stream/316715-contributing/topic/Missing.20record.20field.20decoding
roc-lang/examples #166 adds an example for Encoding
and Decoding
abilities
Can someone look at ^^^ please, it should be quite small. All the tests are happy.
I can look in a minute. Sorry for the delay
@Luke Boswell I gave it a skim too :)
@Eli Dowling I would appreciate if you could expand on your comments a little. I like the idea of showing both a simpler type and a simpler method, and also a more complicated type with the more complicated approach. I was just trying to capture something for later reference, so happy to polish it so it's clearer for future reference. I'm just not sure what you mean. Do you have access to the examples? Are you able to push to that PR?
Even if you flick me some notes, I'll clean it up and add it.
Ok, thanks for the review @Brendan Hansknecht and @Eli Dowling. I've updated. ^^^ roc-lang/examples #166 so should be gtg.
Teeny tiny PR adding List.getUnchecked
: https://github.com/roc-lang/roc/pull/6642
I don't think we should add that
We should force the user to add it
Crash shouldn't be in the standard library in a way that an end user can hit
Should be equally performant to use list.get and the when ... is
and crash
Last I checked, llvm optimizes them the same
Aren't you adding in a a bunch of pointless memory for the tag? or does it just get optimized away?
From reading https://roc.zulipchat.com/#narrow/stream/304641-ideas/topic/panic.20on.20out-of-bounds sentiment seemed to be strongly for adding it
Am I contradicting my past self. Give me a few so I can look this over and think about it more. I do think a better solution would be nice here, but a proper array type would be so many times better....idk....
haha, that was my thought too. This seemed like a compromise that doesn't involve significant additions to the compiler. A compile time bounds checked array would be nice though for high performance buffers and LUTs and such
I guess now I definitely question if this has a gain over forcing the user to do List.get ... |> unwrap
Where unwrap is a when ... is
+ crash
Here is the rust equivalent: https://godbolt.org/z/cTEnW8TYq
LLVM should optimize them to the exact same thing
It will remove the tag fully
unwrap = \res, msg ->
when res is
Ok v -> v
Err _ -> crash msg
# User can do this inline or make an explicit function for:
List.get list index |> unwrap "Out of Bounds"
Also since that disassembly is noisy, here is the important part. These are identical
justUnwrap:
cmp qword ptr [rdi + 8], rsi
jbe .LBB7_2
jmp qword ptr [rip + listGetUnsafe@GOTPCREL]
.LBB7_2:
push rax
lea rdi, [rip + .L__unnamed_4]
call std::panicking::begin_panic::he275593115e721e6
listGetUnchecked:
cmp qword ptr [rdi + 8], rsi
jbe .LBB8_1
jmp qword ptr [rip + listGetUnsafe@GOTPCREL]
.LBB8_1:
push rax
lea rdi, [rip + .L__unnamed_5]
call std::panicking::begin_panic::he275593115e721e6
Well, I think that basically proves it. Bar having fixed length arrays and avoiding the bounds check, it's not getting any faster
So our tags are always equivalent to rust enums? so we can use rust to model roc in Tag/Eunm related scenarios?
They should be. There is a chance we are modeling something in a way that defeats llvm optimization, but I don't think so.
Thankyou, this has been very educational :)
We do have two other big potential list issues:
Not sure specifically what you are working on, but I can take a look with a profiler at some point and try to dig into. There is totally a chance that llvm is failing to optimize away unwrap or some other similar issue. Like it might optimize it away in simple cases but fail for other reasons here.
Well I'll do some testing and let you know, it's a tiny optimization for json parsing.
I'm implementing an alternative json parser modeled after RapidJson and other fast json libraries that allow for streaming json parsing.
I need dynamic Json Decoding and encoding from some type of JsonValue:[Object,Array,string,bool,null,number]
style type so I need to re-implement it anyway and I thought it would be a good benchmark to compare against the normal decode and encode implementation
Sounds exciting
#6646 fixes unwrapping for trailing !
suffixed expressions.
The following PR's add Task.result
#6648 converts a bunch of the parser combinators from macros to functions
It's my first roc PR so lmk if I missed anything :)
#6649 adds support for suffixed when
expressions
#6657 fixes parsing lists in tag patterns and resolves issue #6074
Luke Boswell said:
#6657 fixes parsing lists in tag patterns and resolves issue #6074
This PR still needs a review/approval. @Joshua Warner and I worked on it together, not sure he can accept?
he can, but I just reapproved!
Yep; sorry about the delay there. Busy day!
#6662 adds additional support for trailing !
in the case where we have a suffixed Apply leaf node.
Here are all of the PR's in train that are all ready and correspond to the effort to update the tutorial for the suffix blog article.
Task
Ok
and Err
as type aliases!
syntaxhttps://github.com/roc-lang/roc/pull/6675 - the tutorial update PR
Super minor (single line markdown) PR to fix a visual issue in tutorial https://github.com/roc-lang/roc/pull/6689
I've pushed a number of changes to #6696, it might even pass CI but I suspect there'll be issues. It's still WIP, I think I can also write some build scripts for ruby, swift ui, java etc but that was hard to research on the plane without Wifi. And I'm planning on doing some more polish and general cleanup of things.
I would appreciate any comments or thoughts, I apologise in advance how large it is... but making the change to make platforms responsible for building their binaries kind of touches all the examples.
Also - 6712 is relatively small change that fixes dbg
when unwrapping suffixed !
#6715 - minor changes to update the Glue platform files to the new syntax.
#202 for basic-cli - changed the broken args example to use Weaver instead, good suggestion from @Luke Boswell
Hi folks, let me know if I need to make any changes.
Import parsing and reporting improvements:
https://github.com/roc-lang/roc/pull/6717
https://github.com/roc-lang/roc/pull/6732
Minor improvement for reporting in the language server:
https://github.com/roc-lang/roc/pull/6734
niiiiice, I was just thinking about this when doing that live-coding demo :big_smile:
an even further improvement would be hiding the inline source code context, since you already have that right there in the editor - including the squiggle
Totally. Unfortunately, it’s not something we can do automatically because for a lot of reports, the wording wouldn’t make sense anymore.
Eventually, I think we’ll need a separate reporting renderer for the language server, so we can do rust-analyzer-style blue squiggles for related code
We probably want to generate the reports in a more generic manner (e.g. some data structure with message/location/addition notes/etc) and have each consumer decide how they want to render it.
The formatter in the language server isn't properly upgrading imports. This fixes that:
https://github.com/roc-lang/roc/pull/6739
https://github.com/roc-lang/roc/pull/6757
cc @Luke Boswell
#6762 enables a generic default host libhost
for prebuilt platform binaries when the more specific host is not found, e.g. macos-arm64
.
#6770 moves basic cli tests from examples into crates/cli/tests/cli/
#6769 remove static-site-gen example and replace website with basic-ssg release
#6761 fixes importing ingested file when bundling packages
basic-webserver #54 refactors the host files out into crates, updates configuration, and adds a build.roc
to build all the binaries (surgical linking will need the 6696 PR in roc merged -- but this PR should land first).
It's not ready to merge yet, there are at least two blocking issues.
roc
to the build scriptsROC_LINK_FLAGS="-framework SystemConfiguration" roc examples/echo.roc
. I haven't changed any dependencies. Should we include this in the default linker flags in roc? or have I done something strange that means we now require this?@Brendan Hansknecht do you think we could/should include this framework in roc when we link on macos?
basic-cli #194 refactors the host files out into crates. It's stuck on a linux CI issue. This should also be merged before we remove platform rebuilding from roc cli. Surgical linker will need to be added once the PR 6696 in roc is completed.
Not really sure, will take a deeper look tomorrow
basic-cli #210 -- one liner to .gitignore dynamic libraries
basic-cli #211 adds Env.platform
effect to get the Arch and OS constants withouth shelling out to uname
https://github.com/roc-lang/roc/pull/6785 - fixes await bang desugaring in expect continuation
https://github.com/roc-lang/roc/pull/6786 - detect await bang inside of when branches
https://github.com/roc-lang/roc/pull/6788 fixes some clippy errors (for later versions of clippy) and performs a slight cleanup on some language server code. I don't think it's that risky, but I'm not sure how well this logic is tested by automated tests. Who should I tag for a review on this code?
Maybe @Eli Dowling would be interested? I can have a look also, though not super familiar with that part of the code base.
Nvm, super small change, done :+1:
Hello, I've got a draft PR up for a Str.concatUtf8
builtin. This is my first time contributing, and I've marked as a draft only because there are two places marked with XXX
comments I could use help from maintainers to see if what I'm doing is correct, or help writing a comment explaining what's going on. Otherwise the code seems to work and added tests pass.
https://github.com/roc-lang/roc/pull/6791
Should I leave this as a draft
PR or should I just open it as a regular PR?
Thanks @shua, let's keep it a draft PR until your questions are resolved.
Could one of you take a look @Folkert de Vries or @Brendan Hansknecht?
Naming thing:
Str.concatUtf8: List U8, Str -> List U8
Definitely feels backwards from what I expected. I would have expected this signature:
Str.concatUtf8: Str, List U8 -> Str
So we may want to consider a different name. Generally speaking, it should be in the List namespace if it takes a list first arg. so maybe List.concatStr
or List.concatUtf8
?
Also, the built-in will only be faster for small strings. For small strings, it avoids allocating a temporary list of the data in the string. For large strings, it makes no difference. They seamlessly convert to List U8
.
Yeah, is this adding a Str to a list of bytes, or a list of bytes to a Str?
Yeah, is this adding a Str to a list of bytes, or a list of bytes to a Str?
What about List.appendStr : List U8, Str -> List U8
Should be concat probably. Concat is multi element, append is single element. So append would suggest List Str, Str -> List Str
Could also be List.concatStrBytes
or similar.
I think List.concatUtf8
makes sense. It is specifically a string encoded as utf-8 bytes, as there are other possible (not as common, but possible) byte encodings for a string. We also already have Str.fromUtf8
and Str.toUtf8
to indicate as opposed to just Str.fromList
or something generic.
Since I've been stuck for a few days on module params, I decided to take a little break and fix a longstanding issue: https://github.com/roc-lang/roc/pull/6792
TL;DR: The compiler won't hang when roc test
/roc check
/the lang server encounters a package import on a module
. Instead it will resolve the package from the app, or show a helpful error message.
https://github.com/roc-lang/roc/pull/6795
shua said:
Hello, I've got a draft PR up for a
Str.concatUtf8
builtin.
https://github.com/roc-lang/roc/pull/6791
I've had a look at this, and I think it looks good. Kicked off CI. @Brendan Hansknecht were you able to look at the zig part? Just wanting to confirm you're happy with that.
Yeah, the zig part looks good
basic-cli #206 is ready for review. It adds File.readLine
for buffered IO.
If someone more experienced with Rust could take a closer look at the rust implementation, I'm particularly unsure about how I'm using the thread local. It works well with my testing, but I'm not sure if this is a good way to do this.
thread_local! {
static READERS: RefCell<Vec<Rc<RefCell<BufReader<File>>>>> = RefCell::new(Vec::new());
}
examples #184 updates the local dev script to use a release of basic-ssg, and updated CONTRIBUTING instructions so people can see the site locally before committing PRs.
basic-webserver #19 adds Task.seq
and Task.forEach
(copied from basic-cli).
roc-lang/examples #46 adds a new example which shows how to safely calculates the variance of a population. I made some fixes, so need another approver to merge. Thank you @Fábio Beirão
I fixed the nightly release package not being able to build / run the nodejs-interop/wasm example:
https://github.com/roc-lang/roc/pull/6834
(or building a wasm target at all :smile: )
fix for task bang desugaring in the deps final expression
https://github.com/roc-lang/roc/pull/6837/files
Fix for loading transitive packages: https://github.com/roc-lang/roc/pull/6840
I thought I had fixed this already but @Luke Boswell pointed out it was still broken
Luke Boswell said:
basic-cli #206 is ready for review. It adds
File.readLine
for buffered IO.
Updated post comments and ready for review. Instead of returning an error for EOF we simply return an empty list. This means we can use it like this;
processLine : File.FileReader -> (ReadSummary -> Task [Step ReadSummary, Done ReadSummary] _)
processLine = \reader -> \{ linesRead, bytesRead } ->
when File.readLine reader |> Task.result! is
Ok bytes if List.len bytes == 0 ->
Task.ok (Done { linesRead, bytesRead })
Ok bytes ->
Task.ok (Step { linesRead: linesRead + 1, bytesRead: bytesRead + (List.len bytes |> Num.intCast) })
Err err ->
Task.err (ErrorReadingFile (Inspect.toStr err))
basic-cli #206 adding File.readLine
is ready for a review. Thank you @Sam Mohr for the reviews and feedback -- I think it's a much better implementation.
refactor of some internal compiler error macros: https://github.com/roc-lang/roc/pull/6853
basic-cli #221 eliminates potential sources of bugs which are complicating the upgrade to builtin-task -- by replacing the glue generated code for roc types with roc_std
or hand-rolled equivalents.
@Richard Feldman I was going to copy the majority of the above "glue reduction" changes from basic-cli
to basic-webserver
, but basic-webserver
organizes its FFI a bit differently than basic-cli
. Namely, you created the roc_fn
proc macro 9 months ago (commit) and it's used to wrap all FFI calls in the platform code, whereas basic-cli
just sets up bare FFI calls.
Though I can see the benefits of roc_fn
, it seems better to align basic-cli
and basic-webserver
to make mutual platform task updates easier, and since basic-cli
is the current flagship, I'm thinking we should remove roc_fn
and basically copy over basic-cli
's impl to basic-webserver
. Are you okay with that, or would you rather keep roc_fn
at the cost of heterogeneity?
basic-webserver #58 adds Task as builtin.
Note to run this you will need roc built from this PR #6836 -- this is why CI is currently not passing.
I think it's fine to change basic-webserver to be more like basic-cli, including getting rid of roc_fn
:thumbs_up:
Fix for await bang desugaring and simplification of Defs
parsing: https://github.com/roc-lang/roc/pull/6851
@Joshua Warner please take a look when you have some time
Big thank you to @Ryan Barth #6808 updates preprocess host API is now ready for review.
This PR cleans up this API making it much easier to build surgical linker binaries - resolving some bugs, and also removes the hardcoded libapp
and dynhost
names.
It also unlocks the rebuilding host changes; by making it possible to refactor basic-cli host into crates and still have surgical linker binaries - decoupling it from the rebuilding host changes.
Module params can and typechecking: https://github.com/roc-lang/roc/pull/6861
Still quite a few gen bugs to fix but getting closer
I can't describe how hype that video preview is! Once that and the Task PRs go through, we can get the ecosystem chugging along quite nicely!
Oh wow...yeah, that video preview is epic!
In #6846 I'm removing DecodeError, as well as making Encode/Decode generic over their output/input types respectively. I'm close to making code changes in basic-cli
/basic-webserver
, but I wanted to check in on names and order of type params before I got too far.
Right now, I've got:
DecodeResult input val err : { result : Result val err, rest : input }
Decoder input val fmt err := input, fmt -> DecodeResult input val err where ...
And planning on changing to
Encoder input fmt := input, fmt -> input where ...
I think it should be
DecoderResult state val err : Result (val, state) err
And use state
in general over input
First PR for sqlite improvements: https://github.com/roc-lang/basic-webserver/pull/60
And related PR to update glue generation in roc: https://github.com/roc-lang/roc/pull/6878
@Trevor Settles What is your plan for the decoder and encoder work and do you need help?
I think once the types are fully updated, the second piece would be updating implementations (should be easy, just use list as the state). The final piece, which may be more complex though I'm not actually sure how much it changes is if any of the auto derive functionality needs to change.
Thanks for checking in! I'm still working on it. My PRs are pretty much up to date. I've made one change in crates/compiler/derive/src/decoding/list.rs
one lines 39 and 41. But now I'm trying to figure this out this error. Something about unifying lambdas...
An internal compiler expectation was broken.
This is definitely a compiler bug.
Please file an issue here: <https://github.com/roc-lang/roc/issues/new/choose>
ambient functions don't unify
Progress is a little slow, as I haven't done this kind of thing before, and 1 year old twins take a lot of time, haha. I don't want to hold this up too much. So, if people think I'm close, and just need to do a little more reading/learning, I'll keep working on it. Otherwise, I've got no problems handing it off to someone else, and seeing their solution to the problem
ambient functions don't unify
I think that is essentially a bad internal error that the types don't match. But I don't fully recall, has been a long time since I touched that code.
And not trying to rush you, just thinking about writing a decoder and kinda want to write it for the new format instead of the current ability.
So, if people think I'm close, and just need to do a little more reading/learning
I wish I knew more concretely. Like I think the concrete type work should be relatively quick, but the derive work might be complex.
PR implementing the new map2-based record builders (while still supporting the old style): https://github.com/roc-lang/roc/pull/6883
This is just implementation, docs are coming in a separate PR.
I've updated Weaver to the new record builder syntax. It was pretty easy (it took about 2 hours), and I was able to maintain the same behavior as before. Especially convenient is the fact that the typestate pattern that ensured options are parsed before subcommands or before parameters was able to be transferred over! If anyone is curious, feel free to check out how I implemented this typestate approach with the new syntax in the PR: https://github.com/smores56/weaver/pull/2
No review needed, just a heads up.
minor fixes for parser and desugaring: https://github.com/roc-lang/roc/pull/6888
task bang desugaring with respect to type annotations: https://github.com/roc-lang/roc/pull/6868
it generates weird type error messages tho :exhale: (because of the way I propagated the type annotations. more info in pr)
Kiryl and I had a chat about ^^^. There's a couple of things I think we want to clean up a bit before merging but in general the approach looks like it's good.
We think it might be best to help Josh land the parser changes first, then revisit this when we have the snapshot tests. We can potentially even have the tests include the formatted AST after desugaring whovh would make verifying these changes much easier.
Update the weaver clone in basic-cli to use the new record builder syntax: https://github.com/roc-lang/basic-cli/pull/227
Just release v0.3.0 of Weaver with the new syntax, btw: https://github.com/smores56/weaver/releases/download/0.3.0/GJtHjepVuDUSzWogFflwMiqPnCV5FKR81722WVmUC5E.tar.br
Oh yeah, the new syntax. I should test it on my sqlite pr. Maybe if I'm lucky it will fix the lambdaset issue by changing how things compose.
It's less currying, so that could be a difference
https://github.com/roc-lang/roc/issues/6900
Snapshot tests for suffixed desugaring
#6905 adds impl RocRefcounted for RocResult.
Type annotations for suffixed sugar
The type checks and type annotations propagation for suffixed expressions and statements are ready. The change also includes nice error messages (although not every case is covered, only common cases)
#6907 is ready to review.
Minor refcounting follow up/bug fix with general TODO added around list drop specialization.
File refcounting and mmap for basic cli: https://github.com/roc-lang/basic-cli/pull/230
basic-webserver #62 adds support for parsing multipart/form-data
requests.
#6917 removes the gui and swift examples from roc.
For the GUI example; I moved it to roc-lang/examples PR#6917 -- which is also Ready for Review.
#6918 greatly improves sorting performance.
Generates better copying functions in zig instead of always using memcpy.
Ok, #6918 is now actually ready for a final review.
I changed it to generating the functions in roc and passing them into zig which is the better implementation anyway!
#6933 -- bundle windows .lib
files when making a platform package.
Size: ultra small, Priority: very low
Figured out why auto freeing wasn't working with tcp streams in basic cli. This fixes that and update tcp streams apis!
https://github.com/roc-lang/basic-cli/pull/237
Gets the new sqlite querying api working for basic-webserver!
Targets the refactor-host
branch instead of main
cause it requires RocRefcounted
changes.
https://github.com/roc-lang/basic-webserver/pull/61
Querying sqlite should now be nicer and much more performant:
queryTodosByStatus = \dbPath, status ->
stmt = SQLite3.prepareAndBind! {
path: dbPath,
query: "SELECT id, task FROM todos WHERE status = :status;",
bindings: [{ name: ":status", value: String status }],
}
SQLite3.execute!
stmt
{ SQLite3.map2 <-
id: SQLite3.i64 "id",
task: SQLite3.str "task",
}
PR for adding support for ignoring record builder fields: https://github.com/roc-lang/roc/pull/6968
expect-fx
result =
{ Task.parallel <-
first: Task.ok 123,
second: Task.ok 456,
_ignored: Task.ok 789,
_: Task.ok 0,
}!
result == Ok { first: 123, second: 456 }
Updating tests now, they'll be failing in CI for a bit
Debug tests are passing so it should be good for review
Fix for #6931: https://github.com/roc-lang/roc/pull/6972
Implementing ? -> Result.try
by genericizing the ! -> Task.await
desugaring code: https://github.com/roc-lang/roc/pull/7000
I love how relatively small of a change this is. Nice reuse.
Thanks!
Implementing &foo -> (\record, field -> { record & foo: field })
desugaring: https://github.com/roc-lang/roc/pull/7002
This means we can now do
user = { name: "Sam", id: 123 }
expect user |> &id 234 == { name: "Sam", id: 234 }
Which should unblock the remaining syntax in the Action-State proposal, among other use cases.
Added a deprecation warning for all backpassing usage and removed all non-testing usage from the repo: https://github.com/roc-lang/roc/pull/7005
module []
foo = \result ->
bar <- Result.try result
Ok (bar * 3)
backpassing-deprecation-warning.png
[smores@smoresbook:~/dev/roc]$ cargo run --bin roc -- check Test.roc
Finished dev [unoptimized + debuginfo] target(s) in 0.18s
Running `target/debug/roc check Test.roc`
── BACKPASSING DEPRECATED in Test.roc ──────────────────────────────────────────
Backpassing (<-) like this will soon be deprecated:
4│ bar <- Result.try result
^^^^^^^^^^^^^^^^^^^^^^^^
You should use a ! for awaiting tasks or a ? for trying results, and
functions everywhere else.
No Brendan, No Cry
Feel free to gather examples of backpassing that we can't handle with !
or ?
and we can make a case for not actually removing the feature
I think it is a reasonable thing to remove and the replacements cover all the common cases. I just still randomly use it and will miss it
Probably use it most often now with opaque types that wrap functions like the decoder for sqlite results
#7007 implements the Str.dropPrefix
and Str.dropSuffix
builtins.
Not sure if we should fuzz test this to see if we can break it?
Added a deprecation warning for all backpassing usage and removed all non-testing usage from the repo: https://github.com/roc-lang/roc/pull/7005
I’ll miss it most for parser combinators but I will survive
Isaac Van Doren said:
Added a deprecation warning for all backpassing usage and removed all non-testing usage from the repo: https://github.com/roc-lang/roc/pull/7005
I’ll miss it most for parser combinators but I will survive
Let me write you an example of a record builder version later and maybe you won't miss it so much
basic-webserver #70 - adds multipart/form-data
This PR was already merged, but somehow in the process of landing another PR these commits got dropped. It was probably me somehow... I've scratched my head trying to figure out how I did it, because it's rather concerning.
Anyway, this PR is to add them back in.
unicode #17 - updates for syntax, dependencies, and fix for the empty Str case.
I can merge, but would appreciate a second set of eyes to check before I make a release.
@Aurélien Geron maybe you can give me a review?
https://github.com/roc-lang/roc/pull/7038 implements dbg
for expressions!
This is finally ready for review: https://github.com/roc-lang/roc/pull/7009
I decided to keep the pass before type-checking for now. I have a branch that moves it after Solve
, but while a lot of cases work, it feels too brittle.
This should work well enough for now, and keeping it isolated will help with the upcoming rewrites in the later stages of the pipeline. We can reconsider it later when those things settle.
Just curious how hard was wiring this through? Thinking longer term about passing around allocators. Which also needs to add a secret arg to tons of functions.
I had a pretty bad time trying to do it in mono
at first. Doing it in its own pass was pretty straightforward overall.
I imagine allocators won’t be polymorphic, though, so that might make a big difference
Not polymorphic, but potentially more pervasive in terms of loading. Could be used at any random point and deals with finalized allocation details which may not be know until after mono is complete.
Also some open questions around wiring through lambdas and captures.
basic-webserver #72 adds support for verifying Json Web Tokens.
Only supports the HS256, HS384, and HS512 algorithms for now. I've left comments to add the others, but someone with more rust foo might need be needed. For the identity providers I need these algorithms are more than sufficient.
:smiley:
Oh, actually.. I'll need to add a expect test script. I can do that later this evening.
basic-webserver #61 adds @Brendan Hansknecht's Sqlite improvements.
I haven't been able to reproduce any alias analysis errors... I merged latest main (after builtin Task) and fixed up the todos.roc
example.
:smiley:
Threaded task module params fix: https://github.com/roc-lang/roc/pull/7048
For some reason, this wasn't a problem when passing other functions, but it's when I pass those that produce Task
. It was probably just luck :smile:
Fix as
patterns in closure arguments: https://github.com/roc-lang/roc/pull/7050
This is something that was tangentially fixed by the lower params PR, but the formatter would break it.
examples #204 -- adds an example for implementing a custom Inspect
ability for an Opaque type.
It took me a while to find the syntax, so sharing for my future self and others.
MySecret := Str implements [
Inspect { toInspector: mySecretInspector },
]
mySecretInspector : MySecret -> Inspector f where f implements InspectFormatter
mySecretInspector = \@MySecret _ -> Inspect.str "******* REDACTED *******"
expect Inspect.toStr (@MySecret "password1234") == "\"******* REDACTED *******\""
Some fixes to my initial implementation of dbg
expressions https://github.com/roc-lang/roc/pull/7054
Ok, last part of dbg
update is supporting dbg in pipelines https://github.com/roc-lang/roc/pull/7058
Thanks @Anton for the review on #7054 :heart:
Super cool, I think this will be awesome for roctober and advent of code :)
I've made a good first issue #7061 to update the tutorial debugging section to tell people about this :)
#7040 implements --no-color
and --no-header
flags for roc repl
https://github.com/roc-lang/roc/pull/7107 changes Dict.update to work with a Result
Fix for the first issue in #beginners > Compiler panic with module params: https://github.com/roc-lang/roc/pull/7109
Approved!
Update our record builder example to use the new syntax: https://github.com/roc-lang/examples/pull/209
Remove the unused old record builder syntax: https://github.com/roc-lang/roc/pull/7110
https://github.com/roc-lang/roc/pull/6832 ready to merge
Aurélien Geron said:
Apparently it's currently not possible to use the try operator
?
inside anexpect
statement, it crashes the compiler. I filed issue #7081. If anyone can take a look at it, I would really appreciate it, as it would make the Exercism test cases much easier to write and nicer to read. Thanks! :thank_you:
#7115 PR fixes this issue. We weren't desugaring ValueDef::Expect
nodes.
basic-cli #251 update dependencies and use the roc_std and roc_std_heap from roc-lang/roc
Luke Boswell said:
Aurélien Geron said:
Apparently it's currently not possible to use the try operator
?
inside anexpect
statement, it crashes the compiler. I filed issue #7081. If anyone can take a look at it, I would really appreciate it, as it would make the Exercism test cases much easier to write and nicer to read. Thanks! :thank_you:#7115 PR fixes this issue. We weren't desugaring
ValueDef::Expect
nodes.
Bump -- can I get an review/approval on this please? it's a pretty small change, 90% of it is just adding a new test to cover this new usecase.
On it
@Luke Boswell the PR has been approved.
Luke Boswell said:
basic-cli #251 update dependencies and use the roc_std and roc_std_heap from roc-lang/roc
Updated this PR -- ready for another review/approval
#7128 fixes desugaring for top-level annotated expressions with a suffixed statement last.
@Sam Mohr can you please double check my logic on this one. I worked through this with some println debugging to resolve the issue, and everything seems to be passing now.
But I'm not super confident in my explanation for why it fixes it, so I would appreciate it if you could check my explanation is reasonable.
#7007 adds Str.dropPrefix
and Str.dropSuffix
builtins
@Luke Boswell I'll review in about 3 hours
Hi! Warming up for Roctober fest, so here is #7146 that extends Num.neg from I64 & U64 to all other sizes of integers. Can I have a review on it? Will gradually go for something bigger next time. Dec or float negation come to mind.
#7147 is the PR from the work done on stream with some cleanup and testing
If anyone has time, please review the return
keyword PR: https://github.com/roc-lang/roc/pull/7173
It already has a parser "LGTM" from the man himself, Joshua Warner, so just a skim over to make sure the canonicalization makes sense would be great. Feel free to merge if you're happy
The try
desugar PR is ready for review: https://github.com/roc-lang/roc/pull/7193
Note, I specifically didn't add tests in cli_run.rs
because:
--prebuild-platform
pull request that I don't want to add more merge work on that plateModule params typechecker fix: https://github.com/roc-lang/roc/pull/7198
Fixes imports in expects: https://github.com/roc-lang/roc/pull/7199
Handle return
syntax errors in reporting: https://github.com/roc-lang/roc/pull/7202
I was very confused to get an unhandled return
syntax error in some old code. Turns out I was using "return" as a def name :upside_down:
This should help us remember to handle syntax errors in reporting: https://github.com/roc-lang/roc/pull/7203
https://github.com/roc-lang/basic-cli/pull/258 -- adds Locale.get
and Locale.all
to basic-cli so people can build applications that support l10n
https://github.com/roc-lang/basic-cli/pull/259 -- adds Stdin.readToEnd
to basic-cli. This is helpful for reading larger inputs when piped to a roc app, such as I discovered when upgrading my 2020 solution here
Fix for the issue Jasper found: https://github.com/roc-lang/roc/pull/7206
Adds the initial set of effectful builtin helpers: https://github.com/roc-lang/roc/pull/7211
Renames List.split to List.splitAt and adds List.splitOn and List.splitOnList https://github.com/roc-lang/roc/pull/7213
These PR's were approved last week. No big deal if you're holding off on merging them. I just want to make sure they weren't forgotten about.
https://github.com/roc-lang/roc/pull/6967
https://github.com/roc-lang/roc/pull/7196
I was leaving them for you to merge... :sweat_smile:
Can you do that? Or maybe that's a permission thing?
@Luke Boswell
Yeah, I don’t think I have permission.
https://github.com/roc-lang/roc/pull/7196
This one is blocked because it looks like one of the tests failed randomly. I’m guessing it just needs a rerun.
Renames List.split to List.splitAt and adds List.splitOn and List.splitOnList https://github.com/roc-lang/roc/pull/7213
This PR is now updated to also rename Str.split to Str.splitOn so it’s ready for review again.
I've fixed the type constraining of early returns in type-annotated functions: https://github.com/roc-lang/roc/pull/7204
It's a short PR, but it'd probably be good to get a glance from someone familiar with the type checking code to make sure I didn't miss something.
Found a codegen issue because I again forgot to run tests locally with --no-default-features --features gen-dev
Please wait to review while I fix this
DM me when ready @Sam Mohr
Fixed and ready for review
implement Num.neg
for dec, f32, f64 in gen-dev (and for dec in gen-llvm) is ready for review: https://github.com/roc-lang/roc/pull/7235
Allow try
/early return in pure statements: https://github.com/roc-lang/roc/pull/7238
Implemented by saying any statement with a return
statement somewhere inside it doesn't need to be pure. We suggested we wanted to only allow {}
-returning statements to work with this, but I supported other statements as well, requiring the value to be ignored. It seemed like the more intuitive approach.
Not exactly for review, but can I get another CI run on https://github.com/roc-lang/roc/pull/7235 ? I've added some more logging to try to debug failures I can only seem to trigger in CI runs. Converted the PR to draft so I don't accidentally merge those changes.
Didn’t realize this thread existed, cross posting
Hello!
As my first contribution to Roc, I am working on implementing snake_case for lowercase identifiers as discussed in #ideas > snake_case instead of camelCase . I don't have a TON of Rust experience, and obviously new to working on Roc, so I would like as many eyeballs as possible on the PR. Anyone that is familiar with the parsing and canonicalization phases of the compiler please take a look (Other Rustaceans feel free as well :smile: ).
hopefully a tiny review: https://github.com/roc-lang/roc/pull/7247 add '.helix' editor config to gitignore
rm unused dependencies from root Cargo.toml : https://github.com/roc-lang/roc/pull/7248
another one for gen-dev https://github.com/roc-lang/roc/pull/7250 implement trivial isNaN,isFinite,isInfinite for Dec
Allow host-exposed suffixed pure functions: https://github.com/roc-lang/roc/pull/7254
gen-dev https://github.com/roc-lang/roc/pull/7264 impl Saturated variants for u128/i128
May have also found a bug with Dec mulSaturated implementation (left a note in the PR)
#7265 updates cargo deps to consistently use workspace = true
everywhere.
NumPowInt should panic on overflow: https://github.com/roc-lang/roc/pull/7277
#7282 fallback to legacy linker if legacy host is available and NOT READY--linker
flag is not provided.
Add platform data when root is module and stop crashing on single file check
https://github.com/roc-lang/roc/pull/7283
PR fixing issues that luke found with purity inference and module params:
https://github.com/roc-lang/roc/pull/7285
Fix for errors caused by use of the changed Str.splitOn
in the basic-cli Arg module
https://github.com/roc-lang/basic-cli/pull/275
I think this is going to break across different recent compiler versions.
@Ryan Barth we just moved to Str.splitOn
in this PR from 2 weeks ago, it looks like you're trying to revert that and the CI is expectedly failing. Am I missing something?
PR fixing early return vars not generalizing, 6 line change plus a single test: https://github.com/roc-lang/roc/pull/7286
No, I just found this message. My mistake, I will close it.
Update tutorial with recent syntax changes
https://github.com/roc-lang/roc/pull/7274
Especially the latest addition - syntax changes that we want AoC newcomers to ignore: https://github.com/roc-lang/roc/pull/7274/commits/13e3d5445169e9e7e8e88e0403bb1ae82246ec34
CC @Anton @Brendan Hansknecht @Eli Dowling @Luke Boswell @Sam Mohr
(I'm very open to the PI section including more/better explanations - I'm noob)
Stops the language server from crashing all the damn time.
I finally figured out that the roc compiler was calling exit on the process instead of panicking. No wonder it crashes constantly!
https://github.com/roc-lang/roc/pull/7288
Keeping them coming!
Adds basic tag completion. Though without any info on what the type of the tag is:
https://github.com/roc-lang/roc/pull/7290
Could I get a re-review on this RocBox dealloc platform helper?
https://github.com/roc-lang/roc/pull/7280
Anthony Bullard said:
Add platform data when root is module and stop crashing on single file check
I think I'll need another review on this since I force pushed
PR for a real try
keyword with type checking and error reporting: https://github.com/roc-lang/roc/pull/7296
Even if we don't keep try
around, this work should be easy to transfer to ?
if we move back to that with static dispatch.
this work should be easy to transfer to
?
It would be good to prioritize this, people are regularly hitting sharp edges with ?
Yeah, I agree
The plan is to do that once this gets merged
And I think you've got some good comments from Ayaz to process still right?
Luke Boswell said:
And I think you've got some good comments from Ayaz to process still right?
The comment Ayaz just left is for a different PR, IMO. I asked him how to manage type-checking for statements with early returns in them, including try
.
I probably should have asked through a different channel, but it seems like we tend to have good communication on GitHub comments haha
Anyway, I think this thing is ready to merge once someone double-checks my work
And I'll do the Ayaz stuff in a follow-up, after the ? PR
I'll have some time for roc later and can start looking at all the things people have been working on. :smiley:
https://github.com/roc-lang/roc/pull/7314 impl add/sub/mul wrapped for u128/i128
Could I please have reviews on these 2 PRs:
https://github.com/roc-lang/roc/pull/7312 - Has the test allocator align it's allocation at 16 bytes (and panic if asked for more)
https://github.com/roc-lang/roc/pull/6977 - Adds SHA-256 cryptographic hashing as a builtin module.
@shua -- I'm just wondering if we should add and consolidate the tests a little for the related in gen_num, I'm not sure when we'd ever circle back to do that otherwise.
@Matthew Heath
Run for branch_dir in source_branch_dir target_branch_dir; do
Calculating violations in &branch_dir...
Calculating violations in &branch_dir...
You added panic/unwrap/expect, in this PR their count increased from 1429 to 1430.
These calls can kill the REPL, try alternative error handling.
@Luke Boswell made similar tests for *_wrap
as existed for *_saturated
. I also added the u128/i128 cases that were missing from the saturated test cases.
Luke Boswell said:
Matthew Heath
- merged the testing alignment PR
- add some more updates for builtin sha256, getting closer. It looks like the snapshots need more love and we must've added a panic/unwrap/expect somewhere
Run for branch_dir in source_branch_dir target_branch_dir; do
Calculating violations in &branch_dir...
Calculating violations in &branch_dir...
You added panic/unwrap/expect, in this PR their count increased from 1429 to 1430.
These calls can kill the REPL, try alternative error handling.
I have exactly one idea of what that could be and how to deal with it-
I will try that now.
https://github.com/roc-lang/roc/pull/7321 make Str.fromUtf8 error a little more self-descriptive
super tiny pr, fix for roc --optimize day09.roc
: https://github.com/roc-lang/roc/pull/7326
https://github.com/roc-lang/roc/pull/7335
Makes the language server display parsing errors at the correct location.
Feel free to merge if it passes CI, I'm going to sleep :)
@Anton @Luke Boswell
Thanks @Eli Dowling, I'll check it out, good night :)
basic-cli #283 cleans up a number of things;
#7338 - dbg and expect improvements
roc main.roc
or roc run main.roc
Do dbg
and expect
remain in with roc build --no-link
and roc build --optimize --no-link
?
@Brendan Hansknecht this is amazing, will be a nice improvement for the embedded use-case, something I've been needing for roc-ray, roc-wasm4, and js-dom etc.
Do
dbg
andexpect
remain in withroc build --no-link
androc build --optimize --no-link
?
Didn't explicitly test, but they should
Yes they do
Luke Boswell said:
JanCVanB said:
Btw
roc glue
seems to be working well so far - now debugging whyconst _SIZE_CHECK_union_Timing: () = assert!(core::mem::size_of::<union_Timing>() == 4);
is erroring.This is a known issue. The generated code is just wrong. See https://github.com/roc-lang/roc/issues/6012
https://github.com/roc-lang/roc/pull/7352
Comment out failing glue assertion for now
basic-cli #287 - refactor rust fx impl out into reusable crates.
With this change, I think we're ready to take all the nice things we've added to basic-cli and port them across to basic-webserver. This should make it very easy to do and now we can have one place where these functions are implemented.
Awesome!
basic-cli #288 refactor to use danger_noodle_case
for all the things, and also use a common roc_http
crate which should be ready for basic-webserver to also use the same types.
I decided to cleanup the Command glue... so this isn't quite ready for review
I can continue polishing it tomorrow.
Ok, fixed it. This PR is ready for review.
basic-webserver #84 -- upgrade to Purity Inference, danger_noodle_case
, use crates from basic-cli & remove a lot of duplication, remove reqwest
dependency.
basic-cli #293 upgrades the API to main! : List Arg => Result {} [Exit I32 Str]_
by adding a new Arg type and related rust implementation.
Two small PRs which rename Err
to IOErr
to avoid confusion with Result
as requested in a PR comment.
examples #223 upgrades all the examples to Purity Inference, and the latest API for basic-cli and basic-webserver.
Currently using local builds of these platforms, but all tests are :check: for me.
Should be gtg as soon as we have pre-releases of the platforms ready to swap in.**
** I didn't do a sanity pass over the actual README and documentation... just got everything back to working and made some updates as I went.
https://github.com/roc-lang/roc/pull/7398 a number of minor updates to the docs to help with usability, accessibility, and design. See #contributing > New docs template for more details
https://github.com/roc-lang/roc/pull/7402 fixes #7339 to make sure the --migrate flag of roc format
works correctly for record type annotation field names. Should note that it adds a new class of files in test_snapshots. I think it's important to have a good view on the output of format with the migrate flag on.
Looking for some eyes on this draft: https://github.com/roc-lang/roc/pull/7406 for ??
operator
Fixed packages depending on another package to hang forever: https://github.com/roc-lang/roc/pull/7412
Anthony Bullard said:
https://github.com/roc-lang/roc/pull/7402 fixes #7339 to make sure the --migrate flag of
roc format
works correctly for record type annotation field names. Should note that it adds a new class of files in test_snapshots. I think it's important to have a good view on the output of format with the migrate flag on.
Anthony Bullard said:
Looking for some eyes on this draft: https://github.com/roc-lang/roc/pull/7406 for
??
operator
Shout at me if this breaks decorum, but I got some Zulip reactions on these PRs, but no feedback/approvals on the PRs themselves and they've been sitting around since before Christmas. So I'm reposting for some visibility (and one of them is blocking moving forward on other error handling improvements).
I would approve on GH but I'm on mobile :big_smile:
I'll do it
Sam is my personal hero
The 7402 PR is intimidating - and might require more thought - so don't rush it. I added snapshots for formatting after migration
I also don't personally have override power for the "panic check" CI check
#7418 - Fix for #7417, which is incorrect links being generated for docs pages containing submodules.
href="Sub.Module"
href="Sub/Module"
@Ian McLerran you've got clippy issues: https://github.com/roc-lang/roc/actions/runs/12518839708/job/34922040995?pr=7418
Should be good now
For some reason markdown-link-check
got cancelled
I'll retry it when the option becomes available
https://github.com/roc-lang/roc/pull/7419 fix '1e2' panic in repl
https://github.com/roc-lang/roc/pull/7421: Parens and Commas syntax support
Super minor pull request. Just reduces verbosity of llvm passes: https://github.com/roc-lang/roc/pull/7423
Another small pr. Avoids roc_std writing to read only refcounts, which can lead to segfaults.
https://github.com/roc-lang/roc/pull/7427
And finally, the larger PR (though essentially 100% code that was already reviewed in basic-webserver), add sqlite to basic-cli as a crate that can later be used by basic-webserver as well: https://github.com/roc-lang/basic-cli/pull/299
https://github.com/roc-lang/roc/pull/7437 docs issue
#7439 - Add List.walk!
#7441 - linker/macho: successfully emit a broken executable
Jakub Konka said:
#7441 - linker/macho: successfully emit a broken executable
Fixed the tests (all pass locally) so ready for re-approve whenever possible. Thanks!
#7443 - Bump object dependency to latest (0.36.7)
Nothing major, as in the title, bumps object
dep to latest and updates API usage.
Makes our refcounting better when set to atomic mode. Uses highest bit of the refcount to check if the variable is threadlocal. Threadlocal variables fall back on a fast path. This makes "atomic" refcounting with a single threaded app run within a few percent of nonatomic refcounting.
The change is completely behind a constant and does not change any current roc code.
#7444
#7448 -> Make refcounting from 1 to max_size. 0 is still constant refcount. the first bit is reserved to indicate if atomic refcounting is required. Would be great if someone could take a more detailed look at this to make sure I didn't mess anything up. Luckily, we have the gen_refcount
tests which make me at least medium confident (also the valgrind tests).
Also, not sure when this is bested to land. Will require updating platforms.
#7449 -> Minor capacity cleanup for #platform development > Should lists always have a minimum capacity of 64?
Remove backpassing: https://github.com/roc-lang/roc/pull/7452
#7448 now leads to a small perf improvement too. (tinkered with exact refcounting in zig for some minor extra perf)
Remove roc-for-elm-programmers.md: https://github.com/roc-lang/roc/pull/7453
https://github.com/roc-lang/roc/pull/7450 simplifications to the typechecker ahead of a change to detect invalid annotations of generalized types like x : *
. Hasn't passed CI yet but the relevant tests (reporting, solve, etc) have locally
https://github.com/roc-lang/basic-webserver/pull/89 -> Add improved sqlite to basic-webserver again now that we know how to release it with musl
PR is essentially identical to the old version but dependent on basic-cli for the sqlite implementation. Also updated for purity inference.
7455 there are no compressed sections in Mach-O so they can be safely ignored
7457 easy PR that uses correct page size values depending on the target's CPU architecture for Mach-O for (segment) alignment
omg I am so, so hype about this macho surgical linking progress!!! :heart_eyes::heart_eyes::heart_eyes:
Removes references to Task in:
Approved with one comment
Jakub Konka said:
7457 easy PR that uses correct page size values depending on the target's CPU architecture for Mach-O for (segment) alignment
Can I ask for a re-review @Brendan Hansknecht ? I've removed now-redundant comment as suggested.
I'm on mobile and will be away for a while if anyone else could give it the thumbs up, that would be great. LGTM.
I can approve
Done and merged @Jakub Konka
Jakub Konka said:
7455 there are no compressed sections in Mach-O so they can be safely ignored
I feel embarrassed to ask but can I ask for another re-run of (now a smaller set of) failing tests? :folded_hands:
Done
just added you as a collaborator, so you shouldn't need permission to run tests anymore
A Redo of my PR to fix some issues with snake_cake migration: https://github.com/roc-lang/roc/pull/7460
Richard Feldman said:
just added you as a collaborator, so you shouldn't need permission to run tests anymore
OK, I have restarted nix-apple-silicon
test several times and it's timing out at different steps. Locally there are no problems and nix develop -c cargo test --locked --release -- --skip cli_tests::inspect_gui --skip cli_tests::hello_gui
pass without a hitch. I'm kinda out of ideas what to do next, and would welcome advice how to proceed next.
Can you post some logs for where it gets stuck?
Will do if it gets stuck again. For now I rebased on latest main and signed the commit. Fingers crossed!
Progress! All passed except fuzz tests which the CI says are OK to fail. Can I ask for a force-merge? :pray:
Thanks @Luke Boswell !
https://github.com/roc-lang/roc/pull/7467 <- Support for ??
for optional record fields and a small fix for the fuzzer from the PNC change
basic-cli #305 -- paired breaking change for #7463 upgrades the builtins to snake_case
basic-ssg #13 -- paired breaking change for #7463 upgrades the builtins to snake_case
Testing pre-release for basic-ssg
Testing pre-release for roc-json
#7481 as discussed in -- this PR adds a new cli flag --root-dir
that can be used to add a prefix for all URL links in the static generated-docs.
basic-cli #307 -- this adds the documentation for 0.17.0
and 0.18.0
versions of basic-cli to a static site in the repository, and adds a new CI workflow to deploy the site on PR.
If we include this in basic-cli and host on GH pages (similar to basic-websever and other packages) then we don't need to rebuild in CI with the roc website, and this simplifies the management of breaking changes between roc and basic-cli.
#7482 -- give some love to our Tutorial and the Plans page.
Only includes changes for the tutorial that are currently active in the latest releases. Will make our life easier for updating with the next batch of breaking changes.
#7401 -- cleanup of the examples/
folder -- finally.
Luke Boswell said:
#7482 -- give some love to our Tutorial and the Plans page.
Only includes changes for the tutorial that are currently active in the latest releases. Will make our life easier for updating with the next batch of breaking changes.
Update and addressed all review comments. Thank you @kukimik
Request another review/approval please.
basic-webserver #93 -- paired breaking change for upgrade the builtins to snake_case
and initial PNC calling convention
Luke Boswell said:
basic-cli #305 -- paired breaking change for #7463 upgrades the builtins to
snake_case
Updated with PNC now, all tests passing locally. :smiley:
I'll see if I can kick-off a testing build for basic-cli
Remove Task: https://github.com/roc-lang/roc/pull/7487/files
Align PNC Apply Patterns with Expr: https://github.com/roc-lang/roc/pull/7490. @Sam Mohr this doesn't fix the thing you are mad about yet. But it is important to further align Patterns and Exprs for formatting purposes to fix things in a uniform manner.
Add List.walk_try!
as per #ideas > List.walkTry!: #7491
Str.with_ascii_lowercased builtin #7496 is ready for review! The other similar functions will come after I'm confident about said concerns about refcounting. Is there some info of how one should think about changing the refcounts in a builtin function?
Move to new interpolation syntax: https://github.com/roc-lang/roc/pull/7497
7499 linker/macho: redo bits of preprocessing host
Can I get a CI re-run for #7496? Fixed what I had info on, appli-silicon just timed out, so I hope it had the same problem as the others.
https://github.com/roc-lang/roc/pull/7503 fix a lil bug :bug: with Num.shift_right_by
Jakub Konka said:
7499 linker/macho: redo bits of preprocessing host
@Brendan Hansknecht could I ask you for a review please? Whenever you have the time of course - just putting it on your radar. If anyone else is happy to do a review too then by all means please!
Yeah, was travelling and just got back..should have time to review tonight or tomorrow.
#7507 - Just a little fix for a grammatical error in an error message that has been driving me nuts for months! :sweat_smile:
https://github.com/roc-lang/roc/pull/7514 utf16/32 decoding with lossy variants
https://github.com/roc-lang/roc/pull/7513 - Add context and formatting to tutorial warning banner
(see )
shua said:
https://github.com/roc-lang/roc/pull/7514 utf16/32 decoding with lossy variants
could I get another CI run on this? :clockwise:
https://github.com/roc-lang/roc/pull/7518 New Lambda Syntax, i.e. |x, y| x
Of course the day I post this PR is the day that Zulip is :cricket: :cricket: :cricket: .
I finished the formatting piece...should I just push it to the above PR?
Or maybe separate...
Just noticed that ^^ is a very small PR and has passed CI already
So rather than restart we could just merge it
It's up to you
I just hope Joshua doesn't slap my hand later :tears:
hahaha
I'm sure he'll forgive us
:wink: Love you Josh!
https://github.com/roc-lang/roc/pull/7520 <-- Format ALL lambdas to new syntax
#7521 - Result.map
-> Result.map_ok
Fixed the tests I missed - cargo test
passes 100% locally now.
Implement the ?
binop operator: https://github.com/roc-lang/roc/pull/7523
7524 - macho refactor and better error message when not enough preallocated space in the host for the surgical linker - can I ask someone for a review? There's no new linker functionality, mainly just shuffling things around a little.
I fixed the code and ran the tests and benchmarks locally for #7496, so the next CI run shouldn't fail, like before. Can I get a rerun?
For the above PR, only Apple-silicon test failing (locally passed that test, even with rebasing main into the feature branch) with "Mono output has changed!" (yes, I am indeed changing builtins), but running cargo test -p test_mono -p uitest --no-fail-fast
(as the logs instruct me) doesn't change anything in the repo I could commit. Using nixos with the flake. Any suggestion? Going to bed, but will check tomorrow.
Could try double checking if --release
makes a difference. It shouldn't but it has in the past
Implement and
and or
on top of &&
and ||
: https://github.com/roc-lang/roc/pull/7528
Sam Mohr said:
Implement
and
andor
on top of&&
and||
: https://github.com/roc-lang/roc/pull/7528
I can review in the morning
I can fork it to work on the zero-arg change for now, no worries
Brendan Hansknecht said:
Could try double checking if
--release
makes a difference. It shouldn't but it has in the past
Thanks, but no difference with --release
sadly. As a last resort, I could modify the generated text by hand (I understand this isn't ideal). The only diff shown is ID-s having a +2 increase in a /crates/compiler/test_mono/generated/inspect_derived_dict.txt
. Otherwise I'm blocked on this.
I left a commen on the PR @Norbert Hajagos
Sam Mohr said:
Implement
and
andor
on top of&&
and||
: https://github.com/roc-lang/roc/pull/7528
Approved, but I did leave a comment requesting a specific formatting test
Okay, I'll fix that in the next PR, thanks!
First PR for canonicalization split: https://github.com/roc-lang/roc/pull/7533
I followed @Joshua Warner 's advice and started by moving desugaring only into the new roc_can_solo
crate. Please don't feel pressured to put too much effort into reviewing this PR, it and its successors are intermediate changes and won't look right until the whole thing comes together.
As an aside, this might lead to some merge conflicts based on a few PRs touching desugaring from Josh, I'm happy to wait for those to merge and to handle merge conflicts on my end, since I'd just be copying whatever is in desugar.rs
from the main branch, more or less.
https://github.com/roc-lang/roc/pull/7541 merge wasm_str tests into gen_str
https://github.com/roc-lang/roc/pull/7543 add with_ascii_uppercased and caseless_ascii_equals to Str
Fresh from the press!
basic-webserver #93 -- the big breaking change PR... again
Thank you to @Sam Mohr , @Ian McLerran , @Anton for the collective effort on this one. :smiley:
Exercsim full update to current Roc: https://github.com/exercism/roc/pull/171
.meta/Example.roc files do not need a thorough check, they're mainly there to encure that all tests work
Awesome! I should be able to take a look later today
Shorten the hosted
module header: https://github.com/roc-lang/roc/pull/7553
basic-cli#319 Fix for invalid use of ?
in Path.roc
CI is failing on #7530
Fix try suffix after apply func formatting: https://github.com/roc-lang/roc/pull/7557
Snekking some sneaky non-sneks
https://github.com/roc-lang/basic-cli/pull/320
https://github.com/roc-lang/basic-cli/pull/321
https://github.com/roc-lang/basic-cli/pull/322
https://github.com/roc-lang/basic-cli/pull/323
https://github.com/roc-lang/basic-cli/pull/324
Snekking some sneaky non-sneks
https://github.com/roc-lang/roc/pull/7561
https://github.com/roc-lang/roc/pull/7562
https://github.com/roc-lang/roc/pull/7598 (6 files)
Minor build.zig cleanup for fuzzing and optional deps: https://github.com/roc-lang/roc/pull/7601
What's the idea of only fuzzing on Linux?
I thought you had it working on your mac
Wait... it's target.result.os.tag != .windows
nvm
Yeah, only unix
so mac, linux, bsd, etc
Hoping for more eyes on https://github.com/roc-lang/roc/pull/7597 so we can get that landed and start iterating
Hoping I have the brain power to get the conflicts resolved tonight, but this flu is kicking my butt
Sing out if you want any help
Adding most zig files to test.zig
and resolving resulting compile errors: https://github.com/roc-lang/roc/pull/7604
Cleaning most of our remaining compilation errors in the Zig code, implemented the basics of scope tracking for canonicalization of idents and aliases: https://github.com/roc-lang/roc/pull/7605
I left it in draft mode because I didn't add unit tests yet, I'll try to do that in the next couple of days
Also please ignore the Parse IR changes, I'll revert those, they were temporary for testing
Quick PR to fix our implementation of the FNV hash function https://github.com/roc-lang/roc/pull/7606
If they have an impl, can we just use theirs?
Our implementations are basically the same, theirs just supports using different sizes of integers. I would leave it as it is now unless we need more for some reason
https://github.com/roc-lang/roc/pull/7607
Initial fuzzing of tokenizer with a few minor bug fixes.
https://github.com/roc-lang/roc/pull/7610
Add a check
step to use with zls along with check-fmt
for ci.
Also, check
step is nice in general cause you learn of compiler errors super quick and don't have to worry about it running llvm.
https://github.com/roc-lang/roc/pull/7614 <-- Parser support for braces syntax and string interpolation (ZIG)
Unbreaking main: https://github.com/roc-lang/roc/pull/7617
Fixing some tokenizer bugs: https://github.com/roc-lang/roc/pull/7620
(previously approved, but needs re-approval after implementing feedback)
#7621 Byte-size change to the string store to use 1 buffer for lengths + content.
#7626 [zig] Parsing match
expression and more patterns
#7633 Type Annotation and Declaration parsing and formatting
^ This needs a reapproval after I rebased. Auto-merge is enabled
This PR is a bit more likely to hit merge conflicts, so it would be great to get a quicker review if possible
#7637
cc: @Sam Mohr cause we already talked about this some.
#7638 Parsing Records and Tuples
Anthony Bullard said:
#7638 Parsing Records and Tuples
This also includes BinOps and Expect, Crash, and Return statements and Static Dispatch-style dot access.
And probably should be reviewed and/or merged soon
Nice work :heart_eyes:
#7643 Format a single file via the CLI
Isaac Van Doren said:
#7643 Format a single file via the CLI
Left a few comments
The first bumped PR was already merged
Are you talking about https://github.com/roc-lang/roc/pull/7642
Oh sorry, I actually didn't post the right PR :rofl:
#7642: Remove *
from types and add ...
expression
Approved with one comment, but I'll have to re-approve after you fix the merge conflict
Minor extra cleanups for the SmallStringInterner inspired by #off topic > Talk: "Programming without Pointers"
https://github.com/roc-lang/roc/pull/7645
Can I get another review on https://github.com/roc-lang/roc/pull/7644
Resolved some of the review comments. Added new features, including a FORMATTED section.
17:36:11 ~/Documents/GitHub/roc initial-snapshot $ zig build snapshot
info: processed 2 snapshots in 5 ms.
17:37:20 ~/Documents/GitHub/roc initial-snapshot $ zig build snapshot -- --verbose
info: /Users/luke/Documents/GitHub/roc/src/snapshots/001.txt
info: /Users/luke/Documents/GitHub/roc/src/snapshots/some_folder/002.txt
info: processed 2 snapshots in 1 ms.
It's starting to look like it will be really useful for @Anthony Bullard with the parser and formatter work as we build out more functionality.
^^ not urgent or anything. I need to head off now -- might come back to this in a break tomorrow sometime.
#7649 For migration from slices->DataSpans
#7648 For fixing some issues with SExpr serialization of ParseIR @Luke Boswell
Fix infinite loop in tokenizer: https://github.com/roc-lang/roc/pull/7650
Just a 1 line change to add an exit condition to one case in the loop
Nice, thanks!
Thank the fuzzer
2 line PR to update a dependency again: https://github.com/roc-lang/roc/pull/7652
Just part of my iteration to get all the linux fuzzing happy.
So essentially the same PR, but a second time. Turns out that zig follows symbolic links which defeated my last change. This sets the mode to lto via an environment variable instead: https://github.com/roc-lang/roc/pull/7653
#7658: Move rest of IR to DataSpans
#7663 minor improvement to fuzzing repro scripts and how things get built.
#7664 -- pretty small PR which fixes a bug in SExpr for files that end with a newline, and adds support for import
statements.
I suspect this will need rebasing when @Anthony Bullard lands his changes tomorrow... so no rush on this.
I was looking at Can and figured I'd get my head around the import statements and how to extract the text for that.
#7668 Create simple fuzzer for the parse -> format loop
@Joshua Warner added your feedback. Now all formatter tests and the fuzzer share the same base unit.
import
statements in Parse S-Expr--fuzz-corpus
to copy the SOURCE section from snapshots into a provided file path.--help
for snapshot tool$ zig build snapshot -- --fuzz-corpus ./src/fuzz-corpus/parse/ --verbose
warning: AFL++ requires a full version of llvm from the system or passed in via -Dllvm-path, but `llvm-config` was not found (Only building repro executables)
info: copying SOURCE from snapshots to: ./src/fuzz-corpus/parse/
info: /Users/luke/Documents/GitHub/roc/src/snapshots/003.txt
info: /Users/luke/Documents/GitHub/roc/src/snapshots/001.txt
info: /Users/luke/Documents/GitHub/roc/src/snapshots/some_folder/002.txt
info: processed 3 snapshots in 3 ms.
#7669 - more coverage for Parser s-expressions
#7675 - minor snapshot tool cli arg handling cleanup and removal of no longer needed fuzz corpus (now generated by snapshot tool)
Two micro PRs that cleanup some fuzzing bugs:
#7676 - tokenizer fuzzer generate and
/or
vs ||
/&&
correctly
#7677 - parser, explicitly panic instead of getting stuck in an infinite loop
#7678 - super minor cli cleanup
#7679 - Update to zig 0.14.0
#7680 - Another super small parser PR. crash instead of hanging (I think this is the last hang)
Note: I'm fairly certain all my PRs here are conflict free and can be merged in any order.
Can I please have a review on #7672.
In particular I'd like to know if my approach for handling errors and malformed in the Parser is correct.
Summary:
parse.zig
from line numbersPROBLEMS
, TOKENS
, and FORMATTED
sectionsOk, I've merged changes and made some additional improvements. This PR ^^^ is ready for a review.
Tiny pr to enable optimizing fuzz repro scripts and cleanup two minor printout mistakes: https://github.com/roc-lang/roc/pull/7686
#7687: [zig] Parser: Add Region to node
#7689: Remove ||
and &&
from tokenizer
I'd like to merge https://github.com/roc-lang/roc/pull/7672 unless there's any significant concerns.
It's passing all the zig tests now and there are a lot of follow up things I'd prefer to do in smaller PR's than adding to this mammoth.
Looking now!
Example
~~~META
description=A primitive int
~~~SOURCE
module [foo]
foo = 42
~~~PROBLEMS
NIL
~~~TOKENS
KwModule,OpenSquare,LowerIdent,CloseSquare,Newline,LowerIdent,OpAssign,Int,EndOfFile
~~~PARSE
(file (1:1-2:9)
(module (1:1-2:4)
(exposed_item (1:9-1:12) (lower_ident "foo")))
(decl (2:1-2:9)
(ident (2:1-2:4) "foo")
(int (2:7-2:9) "42")))
~~~FORMATTED
module [foo]
foo = 42
~~~END
#7693 fixes and improve regions for the parser and sexpr formatting.
malformed
on various things#7695: More multiline and comment support in the formatter
#7696: Small PR, fix infinite loop in parser
#7697: Slightly bigger PR dealing with numbers with no digits in them.
Another tiny fuzz bug fix PR in the tokenizer (most of the LOC changes are me adding some doc comments on functions).
Just changes int token printing in the fuzzer loop to avoid a crash. Oh, and removes an assert I just added that the fuzzer found can be wrong.
ultra tiny parser fuzz crash fix: #7699
Ignore more files in the ci manager filter #7701
This just avoids running the old rust ci when changing things like the .gitignore
file.
Enable incremental compilation #7700 (also adds a guide in the readme to enable it with zls)
#7702 fixes 1 fuzz crash - adds malformed node for string_expected_close_interpolation
#7703 Expand roc format to support directories
Larger PR, though mostly moving lines around.
#7704 switch to using buffered io to write the formatter output instead of allocating an arraylist and filling it up before writing to the output.
#7707 Small pr for arena allocation of args and directory walker
#7708 Relatively small PR to stop file loading from incurring extra copies.
Big perf win on my x86 linux machine ~8%.
Also, switches roc format
to counting all the failures instead of early existing on the first failure.
#7709 Another ~8% perf improvement by initilizing more stuff with a capacity.
As a note, part of me thinks that we should always require initializing with a capacity. Cause it avoids extra allocations and memcpy's, which can be quite slow. Even just picking something arbitrary like 16 or 64 is likely fine for many things. Especially if it is just a list of u32 indices. Those barely use any ram in the larger scheme of things.
Long term of course, would be great to tune the size based on what is expected over a very large corpus of roc files.
#7710 improve tracy data collection by waiting for shutdown.
specifically this is nice on macos where tracy is missing this feature.
[#7695}(https://github.com/roc-lang/roc/pull/7695) Multiline and commenting support for the entire grammar
This is ready for review again, but I do have quite a painful rebase to complete after being away for 2-ish weeks :-(
The biggest source of pain in this rebase is moving Formatter away from being a module-level struct. Which introduced whitespace changes to pretty much the entire file and I'm unsure what to keep and what not to
Anything I can do to help with the rebase?
Maybe in the future we should try to avoid doing "large" refactors (in terms of lines touched) on components that are actively being worked on
It’s almost done
Wasn’t that bad really
We are READY TO MERGE!
After this lands, you should mostly be able to write Roc applications, in the v0.1 style, without tokenization or parse errors - and with reasonable style when formatted.
Just needs a :approved: ;-)
Some updates to the syntax migration tool, plus a few fixes to the new compiler, for various bits of syntax encountered in the wild: https://github.com/roc-lang/roc/pull/7716
#7719 Super minor parser hang fix
https://github.com/roc-lang/roc/pull/7716 still needs a review if someone has some time!
I can read through tomorrow!
I’ll take look at the zig code soon
Hopefully in the morning
Think I fixed up all the issues there, if you have time to re-review
I’ll try tonight or in the morning
Hey all, been very inactive due to health and personal issues but now I have the capacity to work on more! Linked below is a PR I forgot to put up before my absence. Thank you again to @Sam Mohr for their help with my questions.
https://github.com/roc-lang/roc/pull/7730
Happily open to any feedback or questions. Thanks!
I'll check it out when I get the time!
Thank you Sam!
#7733 Parse and format other headers
This is ready for re-review ^
what is Module Work, is it just a wrapper around an IR?
Sounds like it would be coordination for compiling a module one depedencies are met, but that is 100% a guess
Here's a description @Wizard ish
In short, we want to be able to refer to data in other modules during compilation
Which requires knowing which module we're using, followed by the index within the module
For that "which module are we talking about" index, we want to have a compiler stage-agnostic mechanism to do that
And a very simple and efficient way to do that is to order modules in reverse compilation order (AKA dependencies first)
And then use the index of each module in that ordered list for referencing which module we need work from
So "module work" is "the IR data for a single module"
But it's not always IR, so it's Work and not IR
so basically, it's a way to structure dependencies between stages and packages?
Sure, more or less
#7744 Replace Slice
s with Range
s in SafeList
and MultiList
& update IRs (from the conversation here)
#7745: Parse and Format where
constraints
Create markdown link checker for glossary.md
https://github.com/roc-lang/roc/pull/7747
:check: I'll take care of that one, I'm going to add a CI check so the script is run automatically.
Ok great :blush:
#7749: Type alias header using parens for args
Jared Ramirez said:
#7744 Replace
Slice
s withRange
s inSafeList
andMultiList
& update IRs (from the conversation here)
I merged main and resolved the conflicts. @Brendan Hansknecht I left a comment for you. Are you able to review again please?
@Anton can you please look at @Lars Frogner's PR in https://github.com/roc-lang/roc/pull/7741
I'm reasonably sure the implementation is good, we just have a CI issue. I'll restart that failed one now and maybe it will resolve iteself.
#7751: Move match branches to use fat arrow
Jared Ramirez said:
#7744 Replace
Slice
s withRange
s inSafeList
andMultiList
& update IRs (from the conversation here)
@Brendan Hansknecht Updated/responded based on your comments! After reviewing, feel free to merge if all looks good!
Will do shortly!
Minor PR to increase some default capacities based on a discussion with Richard from a long while back now (the last meetup).
#7753
initial cache I/O implementation: https://github.com/roc-lang/roc/pull/7755
:point_up: anyone have a Windows VM (or real machine) and could look into why that assertion is failing? https://github.com/roc-lang/roc/actions/runs/14564575038/job/40851987484?pr=7755#step:7:36
the path comes from a tempdir, so should be absolute on both Windows and UNIX... :thinking:
I don't have windows available, but one general note. We want all FS to go though an abstraction
We have a really basic fs mock currently that probably needs work, but it would be good to use here
Needed for future wasm support
Which definitely will be best if we get it building as soon as possible
Specifically in src/coordinate/Filesystem.zig
@Richard Feldman
Brendan Hansknecht said:
We have a really basic fs mock currently that probably needs work, but it would be good to use here
@Richard Feldman let me know if I still need to look at the windows failure.
nah I'll try looking into Filesystem.zig first!
ok, revised it to use Filesystem.zig
- https://github.com/roc-lang/roc/pull/7759
Hoping I’ll have some time this next week to get back into the swing of things
nice, anything in particular you're looking to jump on?
Just the last couple things in the parser and then I can entertain looking into anything else that needs help
7780: Parse and format local dispatch arrow calls
#7783: Parse and format var
and for
statements
#7772: Type unification
It's ready to go, minus a CI issue I'm not sure how to resolve: Zig tests failing on windows, lots of unable to find static system library
I'll check out CI
Hmm, it does not reproduce locally. I also don't understand why this shows up now with this PR.
searched paths: none
That's not going to work :laughing:
Fixed :tada:
Surprise, surprise, it was a caching issue
I didn't even know that folder was cached though
When debugging I've often wanted to have a visual graph of which functions or programs access which files and dirs. I'd like to make something like that for Roc scripts one day. With a visual graph overview I could have immediately seen the missing dir was provided by the cache on normal runs.
#7786: Formatter uses tab instead of spaces
#7792: Remove panics and unreachable statements from Parser
#7793: Next fuzz crash fix. Just deals with some offsets that were incorrect due to ignoring newlines.
:point_up: should be fixed now
#7794: Improve Parse IR SExpr serialization
#7795: the new host ABI we've discussed - @Brendan Hansknecht lmk what you think!
Nice progress :smiley:
#7801: Add me to list of sponsors on Readme (got my receipt and it reminded me)
thanks for all the contributions and the sponsorship @Anthony Bullard! :heart_eyes:
@Richard Feldman I updated #7722 to resolve conflicts with main, but that dismissed approval. Can you re-approve when you have a sec?
@Jared Ramirez done!
#7803: Odds & ends based on type unification PR comments
#7804 I added List.keep_if_try!
That name hurts :hurt:
#7802 -- copy builtins into the the zig compiler. All tests are passing now. For a review, I would recommend just stepping through each commit to see the delta's from the original files. Minor changes for zig 0.14.0 and to make CI linter and typos happy.
Brendan Hansknecht said:
That name hurts :hurt:
Yeah, it's not self-evident but it fits with our conventions
#7807 - stack memory system for the interpreter
I'll have time to give that a proper review tomorrow
nice, thank you! :rock_on:
#7811: Implement type variable occurs check (but do not use it anywhere yet)
not ready for review yet, but big one incoming for layouts: https://github.com/roc-lang/roc/pull/7812
I'll take a look at the occurs
check one tomrorow! :smiley:
#7805: # Support both Polymorphic & Compacted Num
s in the type system
#7817: Add a new CLI argument parser that supports roc main.roc
, basic flags, help messages, error messages, etc.
#7818: Change type descriptors type form ArrayList
to MultiArrayList
#7820 - random Can things.
With this PR we're at the point were we have some simple things working (again :sweat_smile: ) We had some of these things working before, I think @Sam Mohr and @Joshua Warner had implemented some things already, and then we broke them a bit.
@Anthony Bullard's work translating to the same architecture as the Parser laid the foundation here. I've just gone around trying to connect the dots and get it working.
What I am most proud of is we have SExpr and problems/diagnostics for compile-time/run-time error reporting working. Well enough that you can see the snapshots and pick something that isn't behaving correctly and dig in and fix it easy enough now.
Here's an example with two top-level defs
#7823 - adds a .rules
file which explains to AI agents how to use the roc snapshot tool
I found this significantly helps the agents when working with our code. Instead of creating custom debug or test programs, they can write snapshot tests.
#7824 - refactor the Parser
IR
to AST
Node
and NodeStore
into their own files#7825: Detect recursion in unify
with occurs check
#7830 - it's still in Draft... I am going to need more time to really thoroughly review myself. But wanted to share the WIP.
I think I may have broken GH web interface with this PR. :sweat_smile:
Add reporting (ported across from rust) with support for Plain text, HTML, TTY, and LSP ]output formats.
Refactor Tokenize into a separate folder structure (probably didn't need to do this, but I had to refactor parser some for error handling and got carried away).
Refactor Problem/Diagnostic and error handling throughout the compiler. Taking inspiration from Rust I could see we needed richer data, so I refactored the Can Diagnostics to include payloads like idents and string literals. This gives much nicer reporting, here's an example:
~~~PROBLEMS
UNDEFINED VARIABLE
Nothing is named `x` in this scope.
module [add2]
add2 = x + 2
Is there an import or exposing missing up-top?
To do that I pulled the errors out of the ModuleEnv, as this module doesn't have the context to generate good reports, and gave that responsibility to the AST/IR.
Anyway, checkout the snapshots to get a feel for the new reporting. It's loads quicker to checkout the files in the branch directly link to snapshots/ dir in the PR commit
you are doing great work Luke. i should be back to help this week
you're doing 90% of what i had planned to do
and more
Thank you. I'm definitely thinking to myself "what would Anthony do here" on occasions. :sweat_smile:
I'd love to get enough together for a primitive roc check
to work with the new syntax. That feels so close now.
I think I may have broken GH web interface with this PR. :sweat_smile:
Achievement unlocked :star: :p
#7834 - implementation of roc check
using a simplified coordinate that just does a single module.
module [add]
add : U8, U8 -> U8
add = |x, y| x + y
Screenshot 2025-06-17 at 16.14.18.png
Needs some polish but wanted to share because I'm pretty stoked to see it in action :smiley:
Ready for Review :grinning_face_with_smiling_eyes:
Luke Boswell said:
#7834 - implementation of
roc check
using a simplified coordinate that just does a single module.module [add] add : U8, U8 -> U8 add = |x, y| x + y
Taking a look
Approved!
I went ahead and merged it so I can build on top of it (probably tomorrow morning)
Awesome!!
#7837: Add type variable assignment to implemented can exprs
Up next: patterns!
@Jared Ramirez I left some comments, but nothing major so I merged it.
#7939 - removes source
from ModuleEnv
#7840: Add type variable assignment to implemented can patterns
With this and the PR yesterday, the basic idea for how we assign type variables based off CIR nodes should be established, and hopefully it shouldn't be too hard to create the type variables we need as the rest of Can gets implemented!
#7841 - Implement block parsing and stmts in a lambda, add malformed Pattern
I'm a goose. I have been making snapshots with old roc syntax and getting myself very confused. :sweat_smile:
7843: Add all builtin modules to Canonicalizer init
#7846 implement Can for tuple expressions
#7848: Basic type solving for list exprs
#7849 - I've marked this Ready for Review... it's a mammoth yak shaving expedition. I was trying to focus on type declarations... turns out you need a lot of things working before you can see those in action.
type_redeclared
, undeclared_type
, undeclared_type_var
, unused_variable
etclist.map(fn)
until we have types to understand if this is record field access or static dispatch...
expressions and crash
statementspacked struct(u32)
is_ignored
, is_effectful
attributes on Idents, i.e. _ignored
print!
.NamedUnderscore
-- required for _unused_vars
#7854: Basic type error messages (rough 1st pass, will be improved in future PRs)
#7855 Using .md files for snapshots. Codefences add syntax highlighting .
#7858 error report for expected_colon_after_type_annotation
module [nums]
nums : List U8
# this is incorrect syntax, it should be List(U8)
# give a nice error message
#7859 single module import
exposes
as
https://github.com/roc-lang/roc/pull/7860/files
Document now expects 0 based indexes, so here's a cleanup for Diagnostics. fixes reports rendering
7852: Add Bool and Result builtins to zig compiler in v0.1 syntax
7861: Add simple sqrt to Dec
Luke Boswell said:
#7859 single module
import
exposes
as
Addressed all review feedback. @Anthony Bullard
#7862 - upgrade SafeList
& SafeMultiList
with serializeInto
and deserializeFrom
helpers.
Next step I think is to start testing simple caching using our CIR.NodeStore.
@Richard Feldman #7863 initial round-trip cache for CIR.NodeStore
It feels weird being on the sidelines just watching as all this progress flies by. Currently don't have the energy for hobby programming, but always glad to follow the community and chat.
Luke Boswell said:
#7862 - upgrade
SafeList
&SafeMultiList
withserializeInto
anddeserializeFrom
helpers.Next step I think is to start testing simple caching using our CIR.NodeStore.
Approved, but there is one comment that I think you _may_ want to address now or in a fast follow (just a perf thing)
Thanks, probably a follow up -- I'll leave myself a note
#7866 - side quest refactoring our SExpr API and converting to kebab-case
for nodes. Also includes various cleanup in the toSExpr
functions.
There was a few places in CIR where I added Ids for modes that probably dont need them. Harmless extra information, I can remove later.
#7868 - improve Can for Tag Unions @Anthony Bullard
MyResult(ok, err) : [Good(ok), Bad(err)]
Option(a) : [Some(a), None]
(s-type-decl @4-1-7-8 (id 80)
(ty-header @4-1-4-18 (name "MyResult")
(ty-args
(ty-var @4-10-4-12 (name "ok"))
(ty-var @4-14-4-17 (name "err"))))
(ty-tag-union @4-21-4-41
(ty-apply @4-22-4-30 (symbol "Good")
(ty-var @4-27-4-29 (name "ok")))
(ty-apply @4-32-4-40 (symbol "Bad")
(ty-var @4-36-4-39 (name "err")))))
(s-type-decl @11-1-14-10 (id 87)
(ty-header @11-1-11-10 (name "Option")
(ty-args
(ty-var @11-8-11-9 (name "a"))))
(ty-tag-union @11-13-11-28
(ty-apply @11-14-11-21 (symbol "Some")
(ty-var @11-19-11-20 (name "a")))
(ty @11-23-11-27 (name "None")))))
#7869 - implement can for if-then-else
checkNumber = |num| {
if num < 0 {
"negative"
} else if num == 0 {
"zero"
} else if num > 100 {
"large"
} else {
"positive"
}
}
(can-ir
(d-let (id 109)
(p-assign @3-1-3-12 (ident "checkNumber") (id 72))
(e-lambda @3-15-13-2 (id 108)
(args
(p-assign @3-16-3-19 (ident "num") (id 73)))
(e-block @3-21-13-2
(e-if @4-2-13-2 (cond-var 0) (branch-var 0)
(if-branches
(if-branch
(e-binop @4-5-4-14 (op "lt")
(e-lookup-local @4-5-4-8
(pattern (id 73)))
(e-int @4-11-4-12 (int-var 76) (precision-var 75) (literal "0") (value "TODO") (bound "u8")))
(e-block @4-13-6-3
(e-string @5-3-5-13
(e-literal @5-4-5-12 (string "negative")))))
(if-branch
(e-binop @6-12-6-22 (op "eq")
(e-lookup-local @6-12-6-15
(pattern (id 73)))
(e-int @6-19-6-20 (int-var 85) (precision-var 84) (literal "0") (value "TODO") (bound "u8")))
(e-block @6-21-8-3
(e-string @7-3-7-9
(e-literal @7-4-7-8 (string "zero")))))
(if-branch
(e-binop @8-12-8-23 (op "gt")
(e-lookup-local @8-12-8-15
(pattern (id 73)))
(e-int @8-18-8-21 (int-var 94) (precision-var 93) (literal "100") (value "TODO") (bound "u8")))
(e-block @8-22-10-3
(e-string @9-3-9-10
(e-literal @9-4-9-9 (string "large"))))))
(if-else
(e-block @10-9-12-3
(e-string @11-3-11-13
(e-literal @11-4-11-12 (string "positive"))))))))))
We could probably look at flattening out the e-block
's if they only contain a single expression.
yeah I think it's probably harmless to do that when going from parsed to canonical
I can't think of any downsides
Yeah, at that point there is not really any errors that can be reported about the block itself
#7872: Don't store region in type problem struct, instead lookup from CIR
#7873 partially implements canonicalisation and type checking for Records
{
person: { name: "Alice", age: 30 },
address: {
street: "123 Main St",
city: "Springfield",
coordinates: { lat: 42.1234, lng: -71.5678 },
},
contact: {
email: "alice@example.com",
phone: { home: "555-1234", work: "555-5678" },
},
}
(expr (id 129) (type "{ person: { name: Str, age: Num(Int(*)) }, address: { street: Str, city: Str, coordinates: { lat: Num(Fraction(*)), lng: Num(Fraction(*)) } }, contact: { email: Str, phone: { home: Str, work: Str } } }"))
7876: Parse record shorthand and as
patterns
#7877: Tuple expr type solving
7878: Enforce number literal sizes
#7879 - implement record de-strcutures
#7880 - refactor parser Node.Data to use a union. For now we just make an "untyped" variant.. and in future PR's we can gradually move across common shapes.
Branch record-type-checking
is ready for PR ... I can't seem to get the GH web interface to play ball right now.
It includes
getName : { name: Str, age: U64 } -> Str
getName = |person| person.name
(inferred-types
(defs
(def (name "getName") (type "{ name: Str, age: U64 } -> Str"))
(def (name "main!")
(unknown)))
(expressions
(expr @4-11-6-6 (type "{ name: Str, age: U64 } -> Str"))
(expr @6-9-6-15 (type "*"))))
printName : { name: Str, age: U64 } => Str
printName = |person| {
Stdout.line!(person.name)
person.name
}
(inferred-types
(defs
(def (name "printName") (type "{ name: Str, age: U64 } => Str"))
(def (name "main!")
(unknown)))
(expressions
(expr @6-13-9-2 (type "{ name: Str, age: U64 } => Str"))
(expr @10-9-10-15 (type "*"))))
I can try making a PR again later... :tear:
https://github.com/roc-lang/roc/pull/7881
#7891 -- some more fuzzer fixes
Tiny pr: add isInterned method to token tags.
#7892 Windows arm 11 tests fail with internal CLR error, but otherwise good.
Windows arm 11 tests are good now
#7895: Add type checking for if-then-else statements
module [foo]
foo = if 1 {
A
} else {
"hello"
}
Results in
**TYPE MISMATCH**
This expression is used in an unexpected way:
**if_then_else.md:3:10:3:11:**
```roc
foo = if 1 A
It is of type:
_Num(*)_
But you are trying to use it as:
_[True, False]_
and
**TYPE MISMATCH**
This expression is used in an unexpected way:
**if_then_else.md:5:10:7:6:**
else {
"hello"
}
It is of type:
_Str_
But you are trying to use it as:
_[A]*_
Definitely not a blocker, because this is great, but it would be awesome if in the second one it was something like:
**TYPE MISMATCH IN IF-THEN-ELSE**
This expression is used in an unexpected way:
**if_then_else.md:5:10:7:6:**
else {
"hello"
}
This branch is of type:
_Str_
But the previous branch is of type:
_[A, ..]_
In Roc, the type of each branch of an if-then-else expression must be the same.
Maybe followed by an example
(Unless it's in the LSP)
Yeah definitely! I think we’ll need to do a whole pass at improving type error messages. The current ones are very bare bones
yeah I'm working on improving the list ones right now
sexpr: use dots for region formatting
Remove predictNodeIndex for lists (and give nicer errors for heterogeneous lists)
I'm not confident in the zig compiler yet so I started reading code from the beginning. Performed a minimal cleanup along the way. And have some questions:
offset + length
and begin + end
(we have both patterns in different places)? Also, Region
would have a debug check for the start <= end
SingleQuote
? I guess it was prepared for multiline but now we have different syntax ("""
)?I agree that #1 is strange and we should probably align them. base.Region is used more and probably should be used. I agree with #2, I don't think we need that token at all.
#3 I'd be careful with and ask @Joshua Warner why he made that choice. He's very smart and experienced at this, so I'd assume he made this choice for a good reason (probably saving space)
That's why I'm asking here and haven't introduced any changes yet :wink:
single quotes are number literals for Unicode scalars - e.g. if you put 'é'
into roc repl, it evaluates to the Unicode code point for é
oh right
totally spaced that
i need to add that to the parser
ah, ok. then need to fix tokenizer for it as well. it seems to lack a return statement. going to add to the pr
nevermind. I think now I get why there was unused struct Unicode
:smile:
I'll coordinate with @Joshua Warner on how it was supposed to work
yeah we probably want to do them similarly to double quotes because you can have escapes in there for '\''
and '\\'
and '#'
isn't a comment etc
Micro PR: #7899 print input for fuzz-canonicalize
micro PR: #7900 consider OOMs fuzz failures for canonicalize
#7906 - adds a snapshot summary (README.md)
It currently only contains the total number of snapshots... but we have plans to make this much more helpful.
I managed to get a performance metric into our snapshots... it's a simple upper bound on time taken to process the snapshot (compiler parts) currently set at <10ms.
File | <10ms | Tokenize Problems | Parser Problems | Canonicalize Problems | Type Check Problems |
---|---|---|---|---|---|
001.md |
:check: | 0 | 0 | 0 | 0 |
002.md |
:check: | 0 | 0 | 0 | 0 |
add_var_with_spaces.md |
:check: | 0 | 0 | 1 | 0 |
all_frac_types.md |
:check: | 0 | 0 | 0 | 0 |
all_int_types.md |
:check: | 0 | 0 | 0 | 0 |
Significantly we can say that all the CI machines process that snapshot within 10ms.
#7909 - improves the parsing of Ident
. Another fuzz fix :playful:
// Validate the bytes
if (bytes.len == 0) {
return Error.EmptyText;
}
// Check for null bytes (causes crashes in string interner)
if (std.mem.indexOfScalar(u8, bytes, 0) != null) {
return Error.ContainsNullByte;
}
// Check for other problematic control characters including space, tab, newline, and carriage return
for (bytes) |byte| {
if (byte < 32 or byte == ' ' or byte == '\t' or byte == '\n' or byte == '\r') {
return Error.ContainsControlCharacters;
}
}
#7908 Another fuzz fix :playful:
@Anthony Bullard -- these commits touch the parser in a small way.
#7907: Improve if-else error messages & fix typechecking bugs
if-else errors now look like:
**INVALID IF CONDITION**
This `if` condition needs to be a _Bool_:
**if_then_else.md:3:10:**
foo = if 1 A
^
Right now, it has the type:
_Num(*)_
Every `if` condition must evaluate to a _Bool_–either `True` or `False`.
**INVALID IF CONDITION**
This `if` condition needs to be a _Bool_:
**if_then_else_9.md:3:11:**
} else if 10 { # Comment after else open
^^
Right now, it has the type:
_Num(*)_
Every `if` condition must evaluate to a _Bool_–either `True` or `False`.
**INCOMPATIBLE IF BRANCHES**
This `if` has an `else` branch with a different type from it's `then` branch:
**if_then_else.md:3:7:**
foo = if 1 A
else {
"hello"
}
^^^^^^^
The `else` branch has the type:
_Str_
But the `then` branch has the type:
_[A]*_
All branches in an `if` must have compatible types.
Note: You can wrap branches in a tag to make them compatible.
To learn about tags, see <https://www.roc-lang.org/tutorial#tags>
#7911 - rename when
-> match
and adds a some new match
snapshot tests.
I'd like to merge this before I start implementing Can for match, as this will keep those PR's cleaner
@Anthony Bullard FYI -- this does touch some helpers in the Parser
Luke Boswell said:
#7906 - adds a snapshot summary (README.md)
It currently only contains the total number of snapshots... but we have plans to make this much more helpful.
I've updated this PR (rebased) and now it is much smaller.
I would like feedback on this before merging. My future plans are to include memory related information in here also. I haven't yet found a great way to do that using the allocators. I'm starting to think along the lines of using the size of the serialised module to cache instead. We only have the CIR.NodeStore currently round tripping to cache in a unit test, but the plan is to expand that to include all of the required information to re-hydate the module, such as interned strings etc.
match
expressions..
and .. as other
for rest in list patterns..rest
syntax in a list**BAD LIST REST PATTERN SYNTAX**
List rest patterns should use the `.. as name` syntax, not `..name`.
For example, use `[first, .. as rest]` instead of `[first, ..rest]`.
Here is the problematic code:
**list_rest_invalid.md:2:13:2:19:**
~~~roc
[first, ..rest] => 0 # invalid rest pattern should error
~~~
^^^^^^
#7917 use Region in tokenize.zig @Joshua Warner please
#7919 - add support for multi-file snapshots
Currently supports directories ending in _package
_app
and _platform
, includes an example src/snapshots/plume_package
with just two files.
#7922 - adds snapshot files for various use cases associated with nominal tags.
@Anthony Bullard I think we need some parser changes for these, it might be best to wait until your completed with the Parser refactor before implementing these. WDYT?
#7920: Type checking for match
#7924: Improve type problem API
#7927: Add back type checking for match
(accidentally got deleted in #7923)
#7929: Type Checking Odds & Ends
#7930: Type check bool binops & unwrap single elem tuples in Can
#7934: add tracing to core roc functions
Basically add tracy to all the functions that might matter for perf.
Switching to byte ranges in the snapshot html generation: https://github.com/roc-lang/roc/pull/7935
#7937: Unify source_code_region with SourceCodeDisplayRegion type
Just minor cleanup for data that is duplicated in raw fields and encoded cleanly in a type.
Actually scratch this one, I am just gonna merge it into my next PR which should be ready shortly and is related.
#7938: Cleanup source code handling for reporting
Essentially this avoids a crap ton of linear scans of the entire source code of files for reporting. It is absolutely fundamental for the perf of reporting on large files with multiple errors.
html snapshot fanciness working for CANONICALIZE and TYPES as well now! https://github.com/roc-lang/roc/pull/7940
Check out a deployed version here: https://joshuawarner32.github.io/roc/snapshots/syntax_grab_bag.html
#7943: Ensure tests are built with '-Dno-bin' such that they can be checked
Spinoff minor change from my other build script exploration. This just makes it so that zig build test -Dno-bin
works and that zig build
builds the tests as well.
as an aside, I've noticed that zig test
tends not to work; it's always gotta be zig build test
is that fixable or just something we have to live with?
zig test
does not use the zig build system.
It just runs tests discoverable from a specific file
I think zig test src/test.zig
should theoretically work.
But yeah, zig build test
is really the right command to my understanding.
Especially if we eventually have test that pull in dependencies like llvm and such.
#7944: Update to zig 0.14.1
This is actually a no-op. Both 0.14.0 and 0.14.1 work on the current compiler with no change to anything. So still leaving 0.14.0 as the labelled minimum zig version.
Another small PR.
#7945: fix '-fincremental'
Just removes usingnamespace
and for now directly exports what is needed.
Brendan Hansknecht said:
#7944: Update to zig 0.14.1
This is actually a no-op. Both 0.14.0 and 0.14.1 work on the current compiler with no change to anything. So still leaving 0.14.0 as the labelled minimum zig version.
This removes valgrind for our snapshots... I'm thinking we might want to wait to upgrade for now.
It only removes it on arm
Still runs on x86
Ohk :thumbs_up:
But yeah, kinda inconvenient that valgrind doesn't support all arm instructions, so it is kinda up to the luck of compilation as to whether or not it will work. That said, it does get better with each new release.
json.Core.Utf8.Encoder
, json.Core.Utf8.decode
{ ..person, age: 42}
I'm probably going to need to spend a day on the fuzzer, and buy @Anthony Bullard a beer (or two) to pay for my sins... but I'd like land these changes so we can work on type checking and implementing where
clause etc.
#7950 Nix flake for the zig compiler + some related changes
#7951: Standardize function name in canonicalize.zig
to all be camel case
I wonder if we can lint and fix that across the codebase
Consistency would be nice
#7953: Type checking for nominal tag unions (not 100% done, still have a few clean up things to do)
module [Color, blue]
Color := [Red, Green, Blue]
blue : Color
blue = Color.Blue
yellow : Color
yellow = Color.Yellow
~~~
# PROBLEMS
**INVALID NOMINAL TAG**
I'm having trouble with this nominal tag:
yellow = Color.Yellow
^^^^^^^^^^^^
The tag is:
_Yellow_
But it should be one of:
_[Red, Green, Blue]_
#7954: CIR Regions go in a separate array
Jared Ramirez said:
#7953: Type checking for nominal tag unions (not 100% done, still have a few clean up things to do)
:point_up: this is now ready for review!
Last updated: Jul 06 2025 at 12:14 UTC