Skip to content

feat(Cabal, cabal-install): Display -O and -g as numeric levels instead of booleans#11937

Open
zlonast wants to merge 4 commits into
haskell:masterfrom
zlonast:zlonast/numeric-render
Open

feat(Cabal, cabal-install): Display -O and -g as numeric levels instead of booleans#11937
zlonast wants to merge 4 commits into
haskell:masterfrom
zlonast:zlonast/numeric-render

Conversation

@zlonast

@zlonast zlonast commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

This PR improves the handling of the debug-info and optimization field to ensure consistency between its configuration and CLI representations.

Changes

  • Config default: Updated the serialization logic to represent the default NoDebugInfo value as 0 instead of False in ~/.config/cabal/config.
  • Internal consistency: Aligned the default DebugInfoLevel between pkgHashDebugInfo and the Parsec instance. This resolves potential inconsistencies when processing manually generated configuration files.
  • Parsing fix: Fixed a bug where boolean flags were not being correctly parsed for the debug-info field. The parser now properly handles both boolean and integer inputs.
    -- TODO: [code cleanup] The following is a hack. The "optimization" and
    -- "debug-info" fields are OptArg, and viewAsFieldDescr fails on that.
    -- Instead of a hand-written parser and printer, we should handle this case
    -- properly in the library.

    -- TODO: The following is a temporary fix. The "optimization"
    -- and "debug-info" fields are OptArg, and viewAsFieldDescr
    -- fails on that. Instead of a hand-written hackaged parser
    -- and printer, we should handle this case properly in the
    -- library.

Template Α: This PR modifies behaviour or interface

Include the following checklist in your PR:

  • Patches conform to the coding conventions.
  • Any changes that could be relevant to users have been recorded in the changelog.
  • Tests have been added. (Ask for help if you don’t know how to write them! Ask for an exemption if tests are too complex for too little coverage!)

@zlonast zlonast force-pushed the zlonast/numeric-render branch from f9af0be to 0eeaea7 Compare June 7, 2026 17:57
@zlonast zlonast changed the title Numeric render feat(Cabal, cabal-install): Display -O and -g as numeric levels instead of booleans Jun 9, 2026
@zlonast zlonast force-pushed the zlonast/numeric-render branch from 0eeaea7 to c08916a Compare June 9, 2026 13:08
@zlonast zlonast added attention: needs-review re: code formatting Automated code formatting with Fourmolu or similar type: refactor labels Jun 9, 2026
@zlonast zlonast force-pushed the zlonast/numeric-render branch 3 times, most recently from 7b61363 to f7abbb6 Compare June 10, 2026 11:04
@zlonast zlonast linked an issue Jun 10, 2026 that may be closed by this pull request
@Mikolaj

Mikolaj commented Jun 11, 2026

Copy link
Copy Markdown
Member

@ffaf1 notices this seems to change the behaviour of cabal (namely, it's output). If so, a different PR template should be used, which asks for a different set of tasks.

Would it be possible to add a test that prints the -O and -g things? Preferably in an early commit, so that it illustrates the modification, showing how it requires a change in the test result.

@zlonast zlonast added the re: config-file Concerning the cabal configuration file and the `--config-file` option label Jun 19, 2026
@zlonast zlonast force-pushed the zlonast/numeric-render branch 2 times, most recently from 968b034 to 011259e Compare June 19, 2026 19:46
@zlonast zlonast force-pushed the zlonast/numeric-render branch from 011259e to 5d8b49f Compare June 19, 2026 19:57
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: config-file Concerning the cabal configuration file and the `--config-file` option type: refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor: Improve rendering of -O and -g flags as numeric levels

2 participants