Does roc have a "lazy list" or "infinite sequence" or stream, etc? I'm thinking about all the things I normally use for advent of code.
Nope
Can be built up in userland, but nothing exists in the standard library or language
got it, thanks. i’m guessing this means no package either.
i may see if i can build one, but i know there are a lot of tricky bits in implementing something like this well
I think someone was messing around with streams before on Zulip, but no idea the state
awkward https://gist.github.com/drewolson/6c1f5157e84a6c387faca0646d91e04a
i solved it!
my nil definition was typed nil : Stream a
but should be nil : Stream _
I'm interested to know why there is a difference there.
My guess is that this might be related to polymorphism or something. Like once you use the top level nil
function it's type becomes fixed to whatever it was used as. So maybe you need to make it a thunk like nil: {} -> Steam a
for it to work with different types?
i'll gist this if / when i actually get it working
yeah i'm running into a few more type issues with this right now
i'm hitting all sorts of compiler bugs :smile:
this is what i have so far, it compiles https://gist.github.com/drewolson/774cc1e16c75510eefb9066a1395f780
but when i try to use it ... bad things happen to the compiler
I was playing around with something similar a few months ago. There should be some things about is on a zulip thread somewhere. I named it Iter, so maybe that helps for looking. If I remember correctly, everything compiled back then as well, but crashed when running
Hopefully the new lambdaset changes that have been tested outside of roc and need to be ported to roc will fix a lot of the issues here.
somewhat related -- is there a good way to catch up on all the "ongoing" stuff around language changes? maybe the answer is "this zullip" :smile:
The big things are on this page, recently closed PRs could also be a good way to follow. And yeah zulip if you want to follow everything :)
The language seems to be shaping up nicely and i'm excited to use it for more stuff (initially advent of code), but things still feel a bit too seg-fault-y to do so, mostly i'm trying to understand when to keep checking back.
but things still feel a bit too seg-fault-y to do so
Yeah, we are aware. We've been landing a lot of big changes lately, hopefully we'll have more time to focus on reliability in the near future. You can check this github search query to see if the amount of segfaults has reduced :)
awesome!
As a note, most of the segfaults I think come from more complex uses of the language (though the compiler can also crash relatively easily, but many of those go away once roc check
errors are fixed). So if you do more imperative style of code with less lambdas and deeply captured data (like a lazy sequence), the language tends to be able to do a lot. But yeah....still not hard to break.
fair. i don’t have a good intuition of what is “complex” right now. a few months ago i segfaulted on arg parsing, but that seems resolved by merging weaver. i swear i’m not trying to be complex for complexity’s sake :grinning:
Sorry, not trying to call you out.
Generally speaking for Roc today, complex in terms of breaking the compiler tends to be lots of nested lambdas. Parser combinators happen to be that. So do lazy sequences. I think a lot of nice functional programming concepts fall into this category sadly. It also is not clear when things will break. Sometimes these features fully work. Other times they break with something that feels simple.
Brendan Hansknecht said:
Sorry, not trying to call you out.
Not at all. The perspective is actually very useful. Every new ecosystem has things that are simple or complex based on their current strengths.
Last updated: Jul 05 2025 at 12:14 UTC