Stream: beginners

Topic: Recursive function type error


view this post on Zulip Drew Lazzeri (Mar 07 2024 at 20:37):

I am running into a strange type error with a recursive function. I made a Minimum Reproducible Example here, with more context: https://github.com/roc-lang/roc/issues/6563

view this post on Zulip Drew Lazzeri (Mar 07 2024 at 20:38):

The error is strange: Value is: "Int a" ... needs to be ... "Int a"

view this post on Zulip Drew Lazzeri (Mar 07 2024 at 20:38):

I'm doing some recursion and some high level function passing too here - maybe it's a lambda set problem?

view this post on Zulip Richard Feldman (Mar 07 2024 at 22:05):

seems likely! @Ayaz Hafiz I know you're busy, but I'd like to look into this - any tips on how to use checkmate to debug something like this?

view this post on Zulip Ayaz Hafiz (Mar 08 2024 at 02:53):

you could use checkmate; the documentation for it is here: https://roc.zulipchat.com/#narrow/stream/395097-compiler-development/topic/checkmate/near/380910750 and https://github.com/roc-lang/roc/blob/7d51d2b000c6de6aad647b4889ebb9e4c716cf7b/crates/compiler/checkmate/README.md#L1-L5

I would suggest trying this without type annotations first though. Does that work?

view this post on Zulip Drew Lazzeri (Mar 09 2024 at 02:09):

Running without type annotations does work! Wonderful! I've added that suggestion to the gh issue, but I didn't see any tags that seemed relevant to make this findable later. Any suggestions?

view this post on Zulip Kiryl Dziamura (Mar 09 2024 at 07:03):

I would assume that it's lambdasets problem which is caused by different types generated for the generic Int a. I encountered a very similar problem that was solved by removing the annotation, but can’t find if I reported it.


Last updated: Jul 05 2025 at 12:14 UTC