You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature request: Support for formatting generated .cabal files using Gild or cabal-fmt #617
Thanks for your great work on hpack! I’ve noticed that when hpack generates .cabal files, the output tends to lack consistent formatting. This can make diffs less easy to understand.
I would be happy if you considered adding support for formatting the generated .cabal files using established formatting tools such as Gild or cabal-fmt. These tools produce clean, idiomatic, and consistent Cabal files that are much easier to read.
Would you be open to adding this feature or providing an option to produce formatted .cabal files?
Thanks for considering this, and for all the effort you put into HPACK!
I haven't used cabal-fmt myself, but from what I read in @tfausak's blog post, it is not diff friendly. Adding support for this specifically is not within the scope of hpack.
Making sure that hpack plays nice with Glide could be viable, though.
hpack extracts formatting hints from any existing .cabal file and tries to minimize diffs when producing output.
In a perfect world
hpack && glide && hpack
would produce the same result as
hpack && glide
What this essentially means is that you would still need to run glide once, but after that hpack will preserve the formatting.
Extracting formatting hints is based on heuristics and likely does not yet cover all scenarios.
We can extend those heuristics so that hpack plays nice with Glide.
Please feel free to open specific issues where hpack does not preserve the format of an existing .cabal file.
Activity
sol commentedon Oct 29, 2025
cabal-fmtmyself, but from what I read in @tfausak's blog post, it is not diff friendly. Adding support for this specifically is not within the scope ofhpack.hpackplays nice with Glide could be viable, though.hpackextracts formatting hints from any existing.cabalfile and tries to minimize diffs when producing output.In a perfect world
would produce the same result as
What this essentially means is that you would still need to run
glideonce, but after thathpackwill preserve the formatting.Extracting formatting hints is based on heuristics and likely does not yet cover all scenarios.
We can extend those heuristics so that
hpackplays nice with Glide.Please feel free to open specific issues where
hpackdoes not preserve the format of an existing.cabalfile.