haskell / haskell/haskell-language-server

More code actions when a default method implementation doesn't work

Open
#3,135 3 comments 0 reactions 0 assignees View on GitHub
component: hls-class-plugin type: enhancement
Dominant language
Haskell
Stars
3k
Forks
455
Avg merge
2d 19h
Merged PRs (30d)
11

Description

## Is your enhancement request related to a problem? Please describe.

When writing code like this:

```haskell
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

```haskell
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:
1. A suggestion to add placeholders for the missing methods, like the hls-class-plugin does.
2. 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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.