More code actions when a default method implementation doesn't work
Is your enhancement request related to a problem? Please describe.
When writing code like this:
instance FromJSON Foo
This produced an error about Foo not having an instance for Generic due to the default implementation of parseJSON and HLS sugests that I make the line look like
instance Generic Foo => FromJSON Foo
This is almost never what anyone wants to do for most type classes.
Describe the solution you'd like
I understand that in the general case, this might be a good idea, like when the constraint is on a parameter of the type in question. So this suggestions shouldn't be removed. I think having these two other suggestions would be greatly helpful for me:
- A suggestion to add placeholders for the missing methods, like the hls-class-plugin does.
- A suggestion to add another instance for the type instead of just the constraint.
Describe alternatives you've considered
N/A.
Additional context
N/A.
This seems like a reasonable feature request. Is this something you're interested in trying to implement?
Yes I am interested in implementing it. I am planing to be at Munihac next Month and I am not sure if I will find time to work on this until then. If nobody else has taken stab at this by then I can hack on this there.
I see the label component:hls-class-plugin on this, I would like to point out that the current code action comes from ghcide, so this would definitely involve some work on ghcide.