Stream: beginners

Topic: Recursive Dispatch


view this post on Zulip Simon Redding (Sep 03 2026 at 14:11):

Hi,
I'm getting an interesting message from the new compiler:

┌────────────────────┐
│ RECURSIVE DISPATCH ├─ This is_eq dispatch would have to call itself to satisfy its own type. ────────┐
└┬───────────────────┘                                                                                 │
 │                                                                                                     │
 │  expect Op(Gte(TagSeverity(Error))) == parse([Field("severity"), Gte, Ident("error")])?             │
 │                                        ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾             │
 └──────────────────────────────────────────────────────────── /home/simon/working/logq/Cli.roc:170:39 ┘

    The dispatcher type is:

        Query.Expr

    Hint: Use a more specific result type, or add an associated function whose is_eq implementation does
    not require the same dispatch on the same type.

Interestingly, this error goes away and the code works if I replace == with a direct call to .is_eq

Does anyone know what's going on here or has anyone else seen this kind of behaviour?

view this post on Zulip Richard Feldman (Sep 03 2026 at 19:26):

@Simon Redding can you share the full example by any chance?

view this post on Zulip Simon Redding (Sep 04 2026 at 08:29):

logq.tar
Here you go.
This is the working version with == replaced by .is_eq in the tests.

view this post on Zulip Simon Redding (Sep 04 2026 at 08:30):

roc --version
Roc compiler version nightly-2026-08-14-549b94e

view this post on Zulip Richard Feldman (Sep 06 2026 at 04:01):

@Simon Redding quick fix for now would be to add a type annotation for is_eq, but I'm working on a fix that will hopefully make it Just Work the way you originally wrote it

view this post on Zulip Simon Redding (Sep 06 2026 at 08:47):

Thanks for jumping on this so quickly Richard.


Last updated: Sep 24 2026 at 15:59 UTC