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

Fix import and non-canonical instance warnings #382

Closed
wants to merge 3 commits into from

Conversation

riz0id
Copy link

@riz0id riz0id commented Dec 22, 2022

This PR has a few changes that fix GHC warnings when building lib:hie-bios and exe:hie-bios:

  • Removes Data.Text.Prettyprint.Doc imports in favor of the Prettyprinter module. The Data.Text.Prettyprint.Doc module has been deprecated since prettyprinter-1.7.0.

  • Removes any redundant imports reported by -Wunused-imports.

  • Encloses the non-canonical return definition specified for CradleLoadResultT in MIN_VERSION_base(4,8,0), fixing the -Wnoncanonical-monad-instances warning.

I expect some of the prettyprinter and redundant imports are actually necessary for backward compatibility. I'm happy to add the correct #if directives to silence these warning if that is the case.

Copy link
Collaborator

@fendor fendor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much, looks good to me, except one nitpick!

src/HIE/Bios/Types.hs Outdated Show resolved Hide resolved
Comment on lines +30 to +31
import Prettyprinter

Copy link
Collaborator

@fendor fendor Dec 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, so far, we used the old style import because @pepeiborra supports, unofficially, HLS for a GHC 8.8.4 stackage snapshot, which only has the old prettyprinter version and doesn't have the new imports. Updating this breaks HLS on a GHC 8.8.4. @pepeiborra Is that still relevant?

Copy link
Collaborator

@fendor fendor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, just waiting a few days for pepe, but since they might be on holiday, might take a while

@riz0id
Copy link
Author

riz0id commented Dec 23, 2022

No worries!

@riz0id
Copy link
Author

riz0id commented Dec 23, 2022

@fendor switching to different versions of GHC to test that the version bounds work correctly would probably go faster with nix so I'm going to set that up to save myself some time. I see that an issue #25 is asking for Nix support and a shell.nix (I think??). If you would like, I can open a separate PR setting up Nix for hie-bios since I'm already going have it ready for finishing this PR.

Asking ahead of time because I know not everyone is alright with Nix coinfecting repositories so if thats the case here no worries.

@fendor
Copy link
Collaborator

fendor commented Dec 24, 2022

If you would like, I can open a separate PR setting up Nix for hie-bios since I'm already going have it ready for finishing this PR.

While I am a nix-user myself, I am a fair bit scared off from maintaining a nix CI. For example, in HLS, nix CI is constantly outdated, which is why we decided to make it a non-blocking CI job... Rendering it relatively useless for nix developers again.
Additionally, I don't quite see where the current set-up is lacking.

So, if you want to "commit" to maintaining the nix CI, I am happy about the contribution, but I don't want to maintain it, unless it is really trivial.

@riz0id
Copy link
Author

riz0id commented Dec 26, 2022

Ah, in that case I won't worry about adding Nix in a separate PR (I don't have space to commit to maintaining anything at the moment).

Out of curiosity though, what do you mean by Nix CI is constantly out of date? I'm not sure I've run into that problem myself. If you could elaborate or possibly link me to an example of an issue that demonstrates the problem I would really appreciate it. I maintain some packages that use Nix CI so knowing about potential pitfalls would be very helpful.

@hasufell
Copy link
Member

Nix is a time sink. Cache misses that lead to compile failures are not uncommon, despite the claim that it's reproducible.

The ecosystem constantly changes its ways on how to do things, so when you update your recipes, you're likely investing a lot of time again.

@riz0id
Copy link
Author

riz0id commented Dec 26, 2022

I'm not sure how a cache miss could lead to a compile failure unless the Haskell package was just not portable? Do you have a specific example of this happening in mind?

@hasufell
Copy link
Member

I'm not sure how a cache miss could lead to a compile failure

Because if you don't hit the cache, you'll rebuild the entire universe. I've seen build failure in CI numerous times then.

I'm not going to dig those out to make a point though.

@riz0id
Copy link
Author

riz0id commented Dec 26, 2022

Thats fine I just wanted to make sure that your point was not related to Nix.

@fendor
Copy link
Collaborator

fendor commented Dec 26, 2022

Out of curiosity though, what do you mean by Nix CI is constantly out of date?

It duplicates the information from .cabal files since nix can't nixify a cabal project automatically, so we have lots of logic for it: https://github.com/haskell/haskell-language-server/blob/master/flake.nix

Also, since it doesn't use the build-plan cabal found, but rather follows a stackage snapshot, you have to customarily override versions, jailbreak, not test, etc...
It is a second source of truth for how to build the project. As such, it is bound to be out-of-date if not everyone constantly uses it.

None of this applies to hie-bios directly, it is likely just 20 lines of nix, but imo nix expressions need to be maintained either way, just as nix CI, upgrading nixpkgs pins, etc...

@fendor
Copy link
Collaborator

fendor commented Mar 16, 2023

If you rebase, this can be merged.

My apologies, I forgot about the PR 😅

@jhrcek
Copy link
Collaborator

jhrcek commented Feb 27, 2024

Closing as all of these fixes were done as part of #429

@jhrcek jhrcek closed this Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants