-
Notifications
You must be signed in to change notification settings - Fork 197
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
Consider defaulting to ghc-lib #1376
Comments
There were two reasons for doing it that way:
|
Less memory and parsing time, yes, but why do you say greater compatibility?
No, but we are willing to give them up in exchange for greater compatibility. Manual Cabal flags have a poor user interface, specially in combination with Hackage.
Ah, this is a good point. Summarising, HLS really wants to depend on the ghc-lib version of hlint, because that one works on all ghc versions and HLS already depends on ghc-lib anyway. Or as we do now, selectively use the ghc-lib hlint on non-native ghc versions, but in a declarative way. I can see how defaulting the flag to true would be a net loss for standalone hlint use cases. It occurs to me that the best solution would be a separate package |
You get a AST out of GHC, that must have had all the right CPP, extensions etc set, because you are using it for compilation. The worry is that when HLS tries to create a second GHC AST, it might get some things wrong. This is a worry, but one careful coding can get around.
Cool, that sounds a reasonable trade-off to make.
Agreed! As to how to proceed, moving to ghc-lib by default will slow down compilation times for GHC 9.2.2 users, but in every other way makes things simpler. Two packages would be a bit of a pain, probably not worth the hassle. So it sounds like default to ghc-lib is reasonable and better for HLS. CC @shayne-fletcher - is there anything you can think that would go wrong if we defaulted to ghc-lib? I know there are some upstream ghc-lib flags that we have to adjust to make things compatible sometimes, but don't think any impact here? |
this blog is what i use to remind myself how all this works. hlint & ghc-lib-parser-ex need to be kept in sync (they both depend on one of
if |
i think this is a reasonable change and would not object to us making it. |
see also shayne-fletcher/ghc-lib-parser-ex#106 (comment). @phadej would you view this change positively too? |
@pepeiborra @ndmitchell are we agreed on this? if you indicate consent i propose to release a major version of ghc-lib-parser-ex with the change and following that send a PR to hlint to use it. |
Sounds good - go for it! |
So I see we have both #1385 (flipping the default to True) and #1378 (adding a subcomponent). @pepeiborra - does the subcomponent make it easier for HSE, even if we just flip the default to always be True? Are there other benefits it provides, or is this an either/or solution? And if it's a choice, which would you prefer? |
The sub component works equally well for HSE (assuming we can work out the syntax to use it). |
If we flip the default value to yes ghc-lib, then the sub component adds nothing for HLS |
Given that new Cabal features tend to have fallout no one can expect (I've been burnt before) I'm inclined to move to ghc-lib on all versions. But alas, that will require waiting for GHC 9.2.3 to have been out a bit longer (a few things still default to 9.2.2) as the Mac build otherwise breaks. I'm envisaging about a month. I guess given we've lived with the issue for a long time, another month seems ok? |
I found one such bug: haskell/haskell-language-server#3095 |
fixed via #1410 |
hi @lf- could you clarify please? what is meant by "one such bug"? |
Sorry, I was unclear. I meant a bug related to reparsing the files in hlint with different flags compared to how they were parsed in hls. |
The Cabal flag
ghc-lib
currently defaults to False. Consider changing the default value to True so that projects like HLS that depend onhlint
can have a workingcabal install ...
command across all GHC versions.The text was updated successfully, but these errors were encountered: