I made a new cor experiment to figure out if I could make a simpler model for effect interpreters to work, and to explore some of the inference changes mentioned in https://roc.zulipchat.com/#narrow/stream/395097-compiler-development/topic/Allowing.20implicit.20cycles.20in.20the.20type.20representation
The good news: I got https://github.com/roc-lang/roc/issues/5464 working with an effect interpreter model without lambda sets (see this playground). The IR is kind of insane though, 2K lines of IR for 50 lines of code (admittedly it's sparse)
Also, composable effect interpreters work
Also for some reason the inference/propagation of type aliases is really nice (hover over some variables here to see)
The next step is to see if this can work with lambda sets, and if so, we should probably translate the new algorithms in-place to the compiler. If anyone wants to play around with this and/or hack on it with your own experiments, let me know. The source is https://github.com/ayazhafiz/cor/tree/base/experiments/compose_fx
this is super exciting! :smiley:
does it already do the "record captures in canonicalization for type annotations" thing that turned out to be necessary for lambda set correctness in annotations?
no, neither mutual recursion nor lambda sets are around
For anyone interested, I've still been working on this sometimes in my free time (current playground). I'm having some trouble getting lambda sets working across the board, but you'll see that most examples work (except the #5464 reproducer examples).
The positive news is I think the idea of going full in to equirecursive types and not trying to track "recursion pointers" in the frontend IR (i.e. before the equivalent of Roc's mono IR) is definitely the way to go
And, I think I've found a much easier method for specializing on types than we currently use (@Folkert de Vries recently talked about the annoyance of having to specialize on a per-symbol basis in the current Roc implementation, which seems unnecessary). Obviously this project is only a subset of Roc, but the monomorphizer and IR generator are each like 400 LoC even with lambda sets
I am SO, SO HYPE about this!!!
how are you feeling about the lambda set issues?
tractable but tricky? Or like "still unsure on whether the problems are even solvable" :big_smile:
Probably tractable, but I don't really know how to solve them right now
I've been trying to track down the latest status on effect interpreters... and this looks like the most relevant thread.
Just wanted to clarify something. Is the type erasure work that Ayaz summarised and Sam was looking at related to effect interpreters?
My loose understanding is that we want to upgrade and have type erasure so we can then implement effect interpreters.
yeah, in essence:
Task
-based concurrency primitive (e.g. Task.map2
or whatever we decide to name it) which actually lets tasks run concurrently requires that Roc's compiler be able to support compiling arbitrary type-erased (and therefore boxed) types in order to store them in tasksTask
-based concurrency.Thank you for summarising. :grinning:
no prob, it's been top-of-mind for a long time - it'll be a huge deal for the language when we have it! :smiley:
Last updated: Jul 06 2025 at 12:14 UTC