-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should type checker reject this or not? #706
Comments
Good question. I know why it rejects this -- it definitely can't instantiate |
@jurgenvinju that was a big hint to jump into the discussion :) |
Hi @mahills I missed this one while traveling I guess. I'll have a look now. |
@mahills @PaulKlint I need more context to understand why The interpreter does this lazily, so you will see the right instantiation eventually with a concrete |
@jurgenvinju there is a full example at the top of this issue: that is the complete context that exists. The call site is the |
As for directly answering the question: should the type checker reject this? I think not, because the function is type correct in itself, namely understanding two possible cases:
But I see no reason for |
Actually, rethinking this, I should add support for this and similar cases. The real reason this doesn't work is simply because the structures don't line up -- you are supposed to pass a list of lists, but are just passing in |
@mahills aha, I see. Yes this can only happen in case of empty lists and sets and maps, but it may happen in a nested fashion, like with parametrized data types or something. In this case binding the parameters for which no witness can be found with |
@jurgenvinju right, that's what I'm going to do (hopefully later today) |
@PaulKlint thanks for pointing out the |
thanks @mahills ! Love it when a plan comes together 👍 |
Works fine now. |
The type checker rejects the following (based on a test for the recently added function
concat
):with the following message:
The interpreter accepts this. I am in favor of following the type checker's choice (and remove this particular test) but just want to have other opinions on this.
The text was updated successfully, but these errors were encountered: