Skip to content

Class plugin type lenses show unnecessary constraints #3240

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

Open
michaelpj opened this issue Oct 3, 2022 · 4 comments
Open

Class plugin type lenses show unnecessary constraints #3240

michaelpj opened this issue Oct 3, 2022 · 4 comments
Labels
component: hls-class-plugin type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@michaelpj
Copy link
Collaborator

On 1.8.0

The lenses for the class plugin show type signatures that include any context from the class itself, e.g.

image

(those constraints appear on the class). This is unnecessary: you can delete the constraints and the signature works because they're implied.

This is I think a similar problem to what we had here #2966 (comment)

I'm not totally sure what to do. Maybe we can ask the GHC devs if there's a way to get the right answer here. Maybe we can just remember the constraints that are in scope and try and get rid of them?

@michaelpj michaelpj added type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. status: needs triage component: hls-class-plugin and removed status: needs triage labels Oct 3, 2022
@michaelpj
Copy link
Collaborator Author

cc @July541

@July541
Copy link
Collaborator

July541 commented Oct 3, 2022

They are different I think, your issue seems easy to deal.

I’m on vocation and will check it several days later:)

@July541
Copy link
Collaborator

July541 commented Oct 22, 2022

From my test, the constraints can be omitted if our implementation doesn't rely on them like f below, while constraints are required if we use them like g below.

image

Currently, hls-class-plugin displays constraints no matter we use them because it doesn't know whether we'll use them later while creating the signature.

Or, should we dynamically change the signature lens depending on users' implementation?

image

@July541
Copy link
Collaborator

July541 commented Oct 22, 2022

Is it possible to rely on hlint to give a hint for redundant constraints for instance methods?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: hls-class-plugin type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

No branches or pull requests

2 participants