Refactor: Improve rendering of -O and -g flags as numeric levels
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
**Improvement/Refactoring request**
Refactor the representation of `-O` (optimisation) and `-g` (debug info) flags in `Cabal` and `cabal-install`.
Currently, these flags are treated as booleans in some parts of the display logic, which necessitates manual hacks and suboptimal rendering. The goal is to:
1. Render these flags consistently as numeric levels (e.g., `-O1`, `-O0`, `-g2`, `-g0`) rather than booleans or `-O`.
2. Remove existing "hand-written" hacky parsers/printers that are currently in place to work around the limitations of `viewAsFieldDescr` with `OptArg` types.
3. Handle these fields properly within the library's reflection/display infrastructure.
**Additional context**
These fields (`optimization` and `debug-info`) are technically `OptArg` types, but they are currently being handled via ad-hoc logic that leads to code duplication and inconsistencies.
By treating them as numeric levels, we align the displayed compiler flags with their actual internal semantics (where level 1 is the default for `-O1`, etc.).
Contributor guide
Assessment
This issue has not been assessed yet.