-
Notifications
You must be signed in to change notification settings - Fork 123
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
Zero or Logic class constraint causes ambiguous inferred type #491
Comments
With the latest version (173ca87 from Nov. 28) I get the error message, "The inferred type for doubleOver is ambiguous." The error can be avoided by modifying the definition of
to one of the following:
The problem is that in In the first workaround, we can use |
I'm bisecting right now to find where things go wrong. Release version 2.5.0 didn't have a EDIT: Bisection shows the first bad revision is d1305b2 from Sept 15, "Add 'Logic' typeclass with operations complement, &&, ||, ^, zero." |
Here's a simpler test case:
|
I improved the ambiguity reporting in Cryptol, so now at least you can seen what's going on:
|
A couple of related issues:
|
NB: The |
We don't do the ambiguity check for now, as it is a bit hard to figure out what's ambiguous. So for now,
In the future, we may want to implement a more generic system to test for ambiguity---perhaps akin to what GHC does. It goes something like this: if |
We might like to do defaulting for the |
Just checking in, current behavior is still as described by #491 (comment), which is that we will infer a polymorphic type that cannot (!) be instantiated. |
With the merge of #952, we now get:
So, at least at the REPL, we get some additional defaulting for these kinds of ambiguous types. The original example still will not load.
|
I think we are unlikely to find a way to have the typechecker accept the original program without user annotations of some sort. I recommend using the |
Here's a bit of code I wrote:
that works fine for me with Cryptol version 2.5.0 (901a1d1), but chokes for @weaversa who has a more recent version.
The text was updated successfully, but these errors were encountered: