-
Notifications
You must be signed in to change notification settings - Fork 291
Prevent new dead Haskell code #5909
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
`allow-import-from-derivation` is true by default in Nix, but if a user has turned it off (as I have recently), our flake will fail without this.
Added Weeder to the default Nix shell. Weeder no longer uses Dhall for its config, replaced it with an equivalent TOML one.
3e6e4dc to
2d70e32
Compare
This is temporary so that weeds can be tracked going forward without having to fix all the existing ones first.
Also ones with debugging functions. I don’t know why, but this caused some additional weeds to be discovered.
To make it more explicit what isn’t being checked.
This doesn’t yet turn off `type-class-roots`, because whitelisting all of those is a pain, but it pre-populates `root-instances` with instances that we would want to keep, even if unused.
aryairani
approved these changes
Oct 1, 2025
Contributor
aryairani
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking it should go into check.sh too if it's going into CI?
This script also gets run as part of `scripts/check.sh`. Since `check-weeds` has to do much of the same work as `check-formatting`, I extracted the common code to a separate Bash file. Also made it so the scripts don’t have to be run from the repo root directory.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This (re?)enables Weeder, which does whole-program dead-code analysis. No Haskell code is touched by this PR.
There are at least three different areas of the code base where I’ve discovered myself fixing code that isn’t referenced anywhere. While I fixed those areas upon encountering them, having dead code around adds noise and introduces confusion like I’ve run into (especially with there being some more-or-less duplicated subsystems, with the old being incrementally replaced by the new)
There was a Weeder config in the repo, but it used the older Dhall format instead of the newer TOML, and has a minimal-enough config that I’m not sure whether it was ever used, and certainly not recently.
Weeder is now also included in the Nix environment and run in CI.
Implementation notes
This is mostly the first few commits from #5392, which was rightly closed.
Loose ends
This PR doesn’t delete any code. All existing weeds are grandfathered in. #5392 attempted to do too much at once, and so nothing got in. This intends to stop the accumulation of weeds first, with removal of existing weeds to come later.