.. if this helps the discussion, here is cabal file "spec"
(see also other files in the same directory)

these types are used to parse .cabal.

one benefit from using these types in reverse (to generate .cabal from .hs) would be:

it is possible to write a few libs which generate well-formed cabal files from a simplified API. It is possible this was done already.