RFC: new intermediate cabal file representation.
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
_Problem:_ Ultimately we want formatting-preserving programmagic refactorings of `.cabal` files.
_Current situation:_
- The parsec parser's `Field` structure is annotated with source position (parametrised over `ann`), but
- values are `ByteString`s
- `Field` could represent any cabal-file-like structure (e.g. nested sections)
- `GenericPackageDescription`
- doesn't have annotations
- some preprocessing already done, like instances of the same field (e.g. `build-depends`) on the same level are merged.
_Solution:_
- Introduce a new structure (`CabalAst ann`) with source annotations, which represents valid (to some degree) cabal files.
- Change parsing pipeline from `Field ann → GenericPackageDescription` to `Field ann → CabalAst ann → GenericPackageDescription`
- As a proof-of-concept, change `cabal gen-bounds` to work on `CabalAst ann`
This RFC doesn't propose how `CabalAst` would look like specifically, as some exprerimentation on implementation is needed. `ghc-exactprint`.
ping @alanz @hvr @dcoutts
Contributor guide
Assessment
This issue has not been assessed yet.