Skip to content

readPackageDescription >>= writeGenericPackageDescription adds strange duplicate stanza #2343

@peti

Description

@peti

I used the following test program

import Distribution.PackageDescription.Parse ( readPackageDescription )
import Distribution.PackageDescription.PrettyPrint ( writeGenericPackageDescription )
import Distribution.Verbosity

test :: FilePath -> IO ()
test cabalFile = readPackageDescription deafening cabalFile >>= writeGenericPackageDescription (cabalFile++"-new")

to read, parse, and write the Cabal file of arithmoi, and I found that the output has a duplicated build-depends stanza I don't understand. The original file (cut down to the relevant part) says:

library
    build-depends       : base >= 4 && < 5, array >= 0.3 && < 0.6, ghc-prim,
                          integer-gmp < 1, containers >= 0.3 && < 0.6, random >= 1.0 && < 1.1,
                          mtl >= 2.0 && < 2.3
    exposed-modules     : ...
    extensions          : BangPatterns
    ghc-options         : -O2 -Wall
    if flag(llvm)
        ghc-options     : -fllvm
    ghc-prof-options    : -O2 -auto

The re-generated expression, however, says:

library
    build-depends:
        base >=4 && <5,
        array >=0.3 && <0.6,
        ghc-prim -any,
        integer-gmp <1,
        containers >=0.3 && <0.6,
        random >=1.0 && <1.1,
        mtl >=2.0 && <2.3

    if flag(llvm)
        ghc-options: -fllvm
    exposed-modules:
        ...
    build-depends:
        base >=4 && <5,
        array >=0.3 && <0.6,
        ghc-prim -any,
        integer-gmp <1,
        containers >=0.3 && <0.6,
        random >=1.0 && <1.1,
        mtl >=2.0 && <2.3
    extensions: BangPatterns
    other-modules:
        ...

Why is that dependency information duplicated in the generated output?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions