Stream: beginners

Topic: Unresolved polymorphic type for func not using type params


view this post on Zulip Jonathan (Jun 01 2026 at 10:29):

I understand that the following is not recommended (i.e., only constrain type parameters at the site where the restriction is necessary), but I was a bit surprised that this led to an error:

    empty : () -> RBTree(k, v) where [
        k.is_eq: k, k -> Bool,
        k.is_lt: k, k -> Bool,
        k.is_gt: k, k -> Bool
    ]
    empty = || {
        Empty
    }
-- POLYMORPHIC VALUE -----------------------------

This top-level value still has an unresolved polymorphic type:
   ┌─ RBTree.roc:64:5
   │
64 │     empty = || {
   │     ^^^^^


Its type is:
RBTree(k, v)
  where [k.is_eq : k, k -> Bool
     , k.is_gt : k, k -> Bool
     , k.is_lt : k, k -> Bool]
Add an annotation or use this value in a way that fixes its concrete type.

Removing the where restrictions stopped the error (empty : () -> RBTree(_k, _v)). From my point of view reading the error message, removing restrictions would open up the space of possible types, not help resolve an unresolved type?

(This error appeared in the last few days as I have just updated the commit I was building from. Can try a bisect if it isn't obvious why this is happening)

view this post on Zulip Anton (Jun 01 2026 at 11:13):

@Jared Ramirez

view this post on Zulip Richard Feldman (Jun 01 2026 at 12:51):

definitely seems like a regression, and I think I might have introduced it :sweat_smile:

view this post on Zulip Richard Feldman (Jun 01 2026 at 12:51):

I'll look into it later today!


Last updated: Jun 16 2026 at 16:19 UTC