Description
Is your feature request related to a problem? Please describe.
When code uses a lot of type classes, it would be useful to go to the definition of the actual method that will be called in the concrete instance instead of the abstract declaration in the class.
For example, when using Data.Binary
, code often looks like this:
instance Binary Foo where
get = Foo <$> get <*> get
in this case, go to definition is not very useful, since it only takes you to the Binary
class itself instead of something concrete.
Describe the solution you'd like
If the concrete instance that will be used is known at compile time (i.e. when there is no SomeTypeClass a =>
context on the current function), go to definition should take you to the instance's method instead of the class. Otherwise, the current behaviour would be preserved.
Describe alternatives you've considered
An alternative would be to have this be some separate command, rather than the go-to-definition. I am not sure if this new behaviour would make it more difficult to go to the class declaration.
Additional context
Related to #2478