-
Notifications
You must be signed in to change notification settings - Fork 195
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
Unrequired language pragmas when using GHC2021 #1386
Comments
It's expected that you don't see any warnings. If you want to ban various extensions (either because they are turned on by default, or because you think they are bad ideas) see https://github.com/ndmitchell/hlint#restricting-items. The extensions passed on the command line are more about getting the code to parse properly, rather than informing HLint of the environment the code is run in. |
While I understand what's happening, I share @dbeacham's confusion. I thought using |
It certainly could. Would |
I am also interested in this, motivated by wanting to automatically remove I took a stab at implementing this in #1464; let me know if this looks somewhat reasonable.
For now, I did not do that as I did not immediately see a strong use case; but it should not be difficult to add if it is desired of course. |
@amesgen - I had the same requirement - switching to GHC2021 and remove the old language pragmas. But that's really easy to do by just using a |
Yeah, good point, #1464 is not strictly required for this use case. It seems to me to be more convenient not having to maintain the complement of |
Can someone share such a rule set? |
At least I would except such warnings; because we really want to highlight unnecessary language pragmas in the code files - so my expectations is that -X parameters usually indicated the default extensions activated in
I jumped at the opportunity to start with an empty list of allowed extensions and just added the used extensions as now reported by
|
I think HLint does need to know about this, because while the above works it causes a warning about a "restricted" extension. This is confusing, because the extension isn't restricted at all - it's just redundant to explicitly enable it. |
(I just switched HLS to use GHC2021, it was annoying) I would really appreciate @amesgen 's change. I am used to hlint helpfully telling me about redundant extensions, so I was very much expecting it to help me out when I switched to I also don't know if hlint supports identifying extensions that are implied by Maybe this would be annoying to some people, but I think the most common way people use hlint is with a tool like cabal, and as such it is IMO a much better UX if hlint appears to know about information in the cabal file as much as possible. |
If I have a file with a flag turned on by
GHC2021
, e.g.{-# LANGUAGE TypeApplications #-}
and run> hlint -XGHC2021 fileWithTypeApplicationOn.hs
should I expect it to pick up the language pragma as unrequired or duplicate?
I'm not currently seeing any warnings but I'm also not sure if that's expected behaviour.
The text was updated successfully, but these errors were encountered: