-
-
Notifications
You must be signed in to change notification settings - Fork 389
Tactics plugin cannot derive program under certain constraints and bindings #563
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
Comments
What does fails mean, here? Is it timing out or not finding any solutions? Stderr should tell you. Please post the reported |
Not finding solutions. I'll update the issue with what stderr reports. |
My guess is that this is again caused by overlapping names in the hypothesis. Tactics unpacks a given constraint's methods into specialized arguments in the hypothesis, meaning it can't currently deal with two givens of the same class for different types. One will always overlap the other. I suspect what's going on between |
I don't have time to work on this in November, but I think it's a pretty easy fix if you'd like to send a PR! Make this be a map to a container of
update these functions to work over that structure: haskell-language-server/plugins/tactics/src/Ide/Plugin/Tactic/Judgements.hs Lines 15 to 17 in 6c14163
and
Make this function concatenate when appending: haskell-language-server/plugins/tactics/src/Ide/Plugin/Tactic/Judgements.hs Lines 101 to 103 in 6c14163
and then follow the type errors until everything compiles again. |
Another example: fgmap :: (Functor f, Functor g) => (a -> b) -> (f (g a) -> f (g b))
fgmap = _ Based on stderr, it looks like it's exactly as @isovector said,
Is there a reason you don't consider instead not instantiating fmap and leaving type class methods generalised? (i.e. as |
There's no reason, just that we didn't think about it when first implementing this stuff. In fact, the underlying issue here is that the hypothesis is a map from names to hyinfos. Keying it by name is stupid, results in bugs like this, and provides literally no benefit. We always just iterate over the container anyway. A better solution would be to key by type, but this has issues with currying and generalized variables. |
This is fixed as of #1347, with the exception of let-bindings (due to let-generalization.) But it will successfully solve things of the form: fJoin :: forall f m a. (Monad m, Monad f) => f (m (m a)) -> f (m a)
fJoin = let f = (_ :: m (m a) -> m) in fmap f Closing this issue, but I'll add the examples here to the test suite. |
Consider
The tactics plugin produces the solution
(\ x -> (>>=) x (\ x11 -> x11))
. However, now considerThe type of
_
is stillm (m a) -> m a
(with Monad constraint onm
), but the tactics plugin fails to find the solution. I tried moving it into a let binding but it still fails.However if we generalize the constraint on
f
toFunctor
, the tactics plugin succeeds;Is solved with
_ = (\ x -> (>>=) x (\ x11 -> x11))
. However moving it into a let binding again causes a failure!This has been tested as of commit 6c14163.
The text was updated successfully, but these errors were encountered: