Skip to content
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

Inlay hints for deriving strategies #4213

Open
michaelpj opened this issue May 5, 2024 · 1 comment
Open

Inlay hints for deriving strategies #4213

michaelpj opened this issue May 5, 2024 · 1 comment
Labels

Comments

@michaelpj
Copy link
Collaborator

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

When you use deriving without deriving strategies, the choice of how the instance is derived is implicit. We could make this explicit with inlay hints.

Describe the solution you'd like

data Foo ...
  deriving <hint>stock</hint> (Eq, Ord)

The tricky bit will be if we have a list of derived classes which use different strategies! I would suggest something like:

data Foo ...
   deriving <hint>stock,anyclass</hint> (Eq, ToJSON)

Triggering this would of course produce

data Foo ..
   deriving stock Eq
   deriving anyclass ToJSON
@michaelpj
Copy link
Collaborator Author

This would be useful as a code action also, so we should make sure to expose it as a code action handler too. "Make deriving strategies explicit" or something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant