Stream: beginners

Topic: ✔ How can I fix my recursive type definition?


view this post on Zulip njlr (Jan 12 2024 at 19:38):

Automaton i o : { step : i -> Automaton i o, o }

Gives this error:

> ── CYCLIC ALIAS ───────────────────────────────────────────────────── main.roc ─

The Automaton alias is self-recursive in an invalid way:

14│  Automaton i o : { step : i -> Automaton i o, o }

What would be a valid way?

view this post on Zulip njlr (Jan 12 2024 at 19:52):

Ah ha!

Automaton i o : [ Arrow (i -> o), Step (i -> Automaton i o, o) ]

Perhaps the error message should say that recursion is possible with at least one ground tag?

view this post on Zulip Notification Bot (Jan 13 2024 at 13:28):

njlr has marked this topic as resolved.


Last updated: Jul 06 2025 at 12:14 UTC