-
Notifications
You must be signed in to change notification settings - Fork 18
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
could not deduce [instance] #530
Comments
Here's a simple standalone program that produces the same kind of error message: {-# LANGUAGE RankNTypes #-}
f :: (forall a. a -> String) -> String
f g = g (\x -> x)
main :: IO ()
main = putStrLn $ f show With the error message:
I agree that it would be great if the error message could mention where the type variable And applying the suggested fix does not work, because the type of the function So I would propose the error message to change to:
And I would also change the error message for a similar error for this example:
It now gives:
I propose changing it to:
Although in this case the user has not actually written |
Thanks for the elaboration, @noughtmare. I also prefer your proposed error messages. |
This seems bad to me for at least two reasons. The first is that the type variable
a
is only made clear in the possible fix. The second is that the possible fix is not a fix.Original post on reddit:
https://www.reddit.com/r/haskell/comments/y40ydi/ghc_could_not_deduce_instance/
The text was updated successfully, but these errors were encountered: