Skip to content

Allow case insensitive bools and move to numeric render#11828

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

Allow case insensitive bools and move to numeric render#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.

Additionally, the rendering of certain boolean‑like flags has been changed to use numeric levels:

  • For the -O (optimisation) flag, True or an unspecified value now renders as -O1, while False renders as -O0.
  • For the -g (debug info) flag, True or an unspecified value now renders -g2, while False renders as -g0.
    This makes the displayed compiler flags more consistent with their internal semantics (e.g. optimisation level 1 is the default).

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 5 times, most recently from 6e1eecb to 3915fa5 Compare May 27, 2026 09:23
@zlonast zlonast force-pushed the zlonast/allow-case-insensitive branch from 3915fa5 to e58c2d6 Compare May 27, 2026 09:27
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.

2 participants