-
Notifications
You must be signed in to change notification settings - Fork 58
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
Can't use parent constraint in function #25
Comments
What happens if you remove the default implementation of >>== and add it to the implementation explicitly? |
Same issue with I then put the default back and tried adding |
I imagine there's still some corners of auto implicit search that need work. Another thing you could try is to write the constraints in the form Foo a => Bar a => a, rather than (Foo a, Bar a) => a. If that makes any difference, it's an interesting piece of information... |
Yeah I tried that on
Strangely changing for the |
related question, in idris 2 is there a way to make the default access in a module |
I haven't implemented |
makes total sense however I was looking at writing |
It will be a bit annoying to add them all, unfortunately. I've done it for quite a few things so far, though, and I think it's still better this way, and has at least made me think about whether things really need to be public export. Meanwhile, I think I see what's going on here. There's a couple of things I haven't got quite right in the search algorithm which only crop up when chasing parent interfaces with multiple constraints and multiple parameters. I'll explain in full once I've fixed it... |
They're just about deciding whether it's okay to start an auto implicit search, not whether it's okay to continue search, which is part of the problem in #25.
I expect it's worth saying a bit more about this, in case it helps someone understand a bit more about how things work internally. The two problems were about determining arguments, and pairs in parent constraints. The implicit search will only start looking when the type is completely resolved (up to determining arguments), so it will search for, say...
...but not
This is fine at the top level, but here when looking for parent constraints, it encounters...
...which means in order to resolve The other bit is a bit annoying, and is about pairing constraints. Ordinarily, constraints written as
...which gives back a pair, but to keep things reasonably efficient the search algorithm will only look for things with the appropriate target type, so it won't check this when looking for a
|
https://github.com/shmish111/Idris-Bifunctors/blob/master/Data/Bimonad.idr#L42
Steps to Reproduce
idris2 Data/Bimonad.idr
Expected Behavior
Type checks successfully
Observed Behavior
If I explicitly add the
Biapplicative p q
constraint I get a different error that I don't understand at all:The text was updated successfully, but these errors were encountered: