Skip to content

Allow case insensitive bools#11828

Open
zlonast wants to merge 1 commit into
haskell:masterfrom
zlonast:zlonast/allow-case-insensitive
Open

Allow case insensitive bools#11828
zlonast wants to merge 1 commit into
haskell:masterfrom
zlonast:zlonast/allow-case-insensitive

Conversation

@zlonast
Copy link
Copy Markdown
Collaborator

@zlonast zlonast commented May 15, 2026

The .cabal file parser now accepts boolean values in a case‑insensitive manner (true, True, TRUE, false, etc.) without emitting a warning.
Previously only True and False were treated as “standard”, and other capitalisations triggered a parse warning. That warning was introduced in 2008 as a backwards‑compatibility shim to prevent Hackage uploads that would break very old Cabal versions. Since all supported Cabal releases can now handle case‑insensitive booleans, the warning has been removed as unnecessary.

origin commit in 2008: e92d6573#r185301031

research done by @jappeace: https://github.com/haskell/cabal/pull/11716/changes#r3243914138

Template B: This PR does not modify behaviour or interface

E.g. the PR only touches documentation or tests, does refactorings, etc.

Include the following checklist in your PR:

  • Patches conform to the coding conventions.
  • Is this a PR that fixes CI? If so, it will need to be backported to older cabal release branches (ask maintainers for directions).

@zlonast zlonast force-pushed the zlonast/allow-case-insensitive branch from 4e15a9c to c846c51 Compare May 15, 2026 10:25
@zlonast
Copy link
Copy Markdown
Collaborator Author

zlonast commented May 15, 2026

@philderbeast You often make pull requests like this, I'm interested in your opinion on this matter.

@zlonast zlonast added attention: needs-review re: project-file Concerning cabal.project files re: user experience User experience (UX) issue re: code formatting Automated code formatting with Fourmolu or similar labels May 15, 2026
@zlonast zlonast force-pushed the zlonast/allow-case-insensitive branch from c846c51 to 03d13bf Compare May 18, 2026 20:43
Copy link
Copy Markdown
Collaborator

@tdammers tdammers left a comment

Choose a reason for hiding this comment

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

LGTM; comments are not show stoppers, just things I think would be worth considering.

Comment thread cabal-install/src/Distribution/Client/ProjectConfig/Legacy.hs Outdated
Comment thread Cabal/src/Distribution/Simple/Compiler.hs Outdated
Comment thread Cabal/src/Distribution/Simple/Compiler.hs Outdated
Comment thread Cabal/src/Distribution/Simple/Compiler.hs Outdated
Comment thread Cabal/src/Distribution/Simple/Compiler.hs Outdated
@zlonast zlonast force-pushed the zlonast/allow-case-insensitive branch from 03d13bf to 01a59e7 Compare May 26, 2026 16:16
@zlonast
Copy link
Copy Markdown
Collaborator Author

zlonast commented May 26, 2026

@tdammers thanks for your feedback!

@zlonast zlonast force-pushed the zlonast/allow-case-insensitive branch 10 times, most recently from 8e1d6a7 to 2bbe4e7 Compare May 28, 2026 09:25
Mikolaj
Mikolaj previously requested changes Jun 4, 2026
Copy link
Copy Markdown
Member

@Mikolaj Mikolaj left a comment

Choose a reason for hiding this comment

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

Could you please clarity what this PR does about -O1 and why (I know it's in the code, but the motivation is not)? How does this relate to the changes from 2008? Thank you!

Comment thread Cabal/src/Distribution/Simple/Setup/Config.hs Outdated
@zlonast
Copy link
Copy Markdown
Collaborator Author

zlonast commented Jun 4, 2026

@Mikolaj

  1. Case-insensitive booleans: The 2008 warning was a compatibility shim for very old Cabal versions. Since we no longer support those, it's safe to remove the warning and allow case-insensitive booleans.
  2. -O1 / -g0 rendering: This is a separate change for consistency. I removed the ad-hoc solutions because I couldn't read them.

@zlonast zlonast force-pushed the zlonast/allow-case-insensitive branch from 2bbe4e7 to 5d77f4f Compare June 4, 2026 20:19
Copy link
Copy Markdown
Member

@Mikolaj Mikolaj 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 for the explanation of the motivation. Makes sense. Would it also make sense to split the -O1 change to a separate PR? Or to a separate commit in this PR?

BTW, does github display it wrong or is the commit "Add NoFlagValue type class" deleting a lot of files?

@Mikolaj Mikolaj requested review from Mikolaj and removed request for Mikolaj June 4, 2026 20:27
@Mikolaj Mikolaj dismissed their stale review June 4, 2026 20:28

I'm satisified regarding this question now.

@Mikolaj Mikolaj removed their request for review June 4, 2026 20:28
@zlonast zlonast force-pushed the zlonast/allow-case-insensitive branch 3 times, most recently from 2579697 to 6ca7382 Compare June 5, 2026 07:40
@zlonast
Copy link
Copy Markdown
Collaborator Author

zlonast commented Jun 5, 2026

@Mikolaj sorry i try to switch from git to jj and some how lost

@ulysses4ever
Copy link
Copy Markdown
Collaborator

-O1 / -g0 rendering: This is a separate change for consistency. I removed the ad-hoc solutions because I couldn't read them.

what is the “change” exactly? I still don’t see an answer to Mikolaj’s question above:

Could you please clarity what this PR does about -O1

And I’d like to see this answered in the PR description and the changelog, if there’s a change in behavior (and the commit message, perhaps; it can be a copy-paste). In particular, Is there a change in cabal’s behavior or is it a pure refactoring?

@zlonast zlonast force-pushed the zlonast/allow-case-insensitive branch from 38646dd to c94287f Compare June 5, 2026 16:46
@zlonast
Copy link
Copy Markdown
Collaborator Author

zlonast commented Jun 5, 2026

@ulysses4ever Sorry, you're right, I misread it. I'll make a separate PR.

You're right, it's a refactoring, that's why I chose template B.

I assume ghc is working correctly and suggest using just one -O1 flag instead of the entire set. I also suggest honestly displaying this -O1 flag to the user, instead of true or false.

@zlonast zlonast changed the title Allow case insensitive bools and move to numeric render Allow case insensitive bools Jun 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

attention: needs-review re: code formatting Automated code formatting with Fourmolu or similar re: project-file Concerning cabal.project files re: user experience User experience (UX) issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants