is there a verbosity flag that supplies more information about missing instances? it would be nice to have the locations of where the instance was requested, not only the transitive callsite.
* No instance for (Foo Int) arising from a use of `f'
* In the expression: f
In an equation for `g': g = f
where I would call Foo a transitive dependency of f via Bar, with the callsite being the equation for g.
In this case, I would like ghc to tell me that Foo was explicitly depended upon in the Bar instance.
Out of curiosity, I tried Idris 2, hopeful that the situation there is better.
moduleFoointerfaceFoo q whereinterfaceBar a whereFoo a =>Bar(List a)wheref:Bar a => a
f = f
g:ListInt
g = f
The error is
Foo.idr:13:5--13:6:While processing right hand side of g at Foo.idr:13:1--14:1:
Can't find an implementation for Bar (List Int) at:
13 g = f
^
This is correct and perhaps better than the GHC error message. However, It would be nice to know that an implementation of Foo Int would solve the problem.
is there a verbosity flag that supplies more information about missing instances? it would be nice to have the locations of where the instance was requested, not only the transitive callsite.
Probably not. That sounds like a nice feature request.
coincidentally, I built a similar thing for Scala
Do you have an example of the error message that needs improvement? I'm having trouble understanding what you mean by transitive call site.
sure!
This results in the error
where I would call
Foo
a transitive dependency off
viaBar
, with the callsite being the equation forg
.In this case, I would like ghc to tell me that
Foo
was explicitly depended upon in theBar
instance.Thanks, I've never noticed that before. It's a pretty terrible error message since you have no idea where (Foo Int) is needed.
I noticed that I had to put the following at the top the file when I tried your example code:
I wonder if those extensions have a bearning on the poor error message?
It doesn't look like removing those extensions helps. I was able to remove the extensions by tweaking the example to :
The error message remains the same.
Out of curiosity, I tried Idris 2, hopeful that the situation there is better.
The error is
This is correct and perhaps better than the GHC error message. However, It would be nice to know that an implementation of
Foo Int
would solve the problem.yeah, it's weird that this is not a first class concern. same thing bothered me five years ago in scala so much that I made this plugin
That's cool. Nice that you could address it using a compiler plugin.