haskell / haskell/cabal

Behavior of function writePackageDescription

Open
#2,410 9 comments 0 reactions 0 assignees View on GitHub
Cabal: file format Cabal: other Cabal: pretty-printer documentation type: bug
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

Hello,

I wrote a small program [bnfcCabal](https://github.com/pascalh/BnfcCabal), which generates very simple cabal files.

This simple program shows how I use cabal functions to create cabal files:

``` haskell
import Distribution.PackageDescription
import Distribution.PackageDescription.Parse
import Distribution.Simple

dep :: Dependency
dep = Dependency (PackageName "base") anyVersion

pd :: PackageDescription
pd = emptyPackageDescription { buildDepends = [ dep ] }

run :: String -> IO ()
run cabalVersion = writePackageDescription (cabalVersion++".cabal") pd
```

Until cabal-1.22.0.0 everything worked fine and my generated cabal file contained the dependency. When using version 1.22.0.0 the cabal file does not anymore contain the dependency.

Is this a bug or am I using the functions wrong (or the wrong functions)?

Here are the generated cabal files using cabal version 1.20.0.3 and 1.22.0.0 respectively:

``` haskell
-- cabal-1.20.0.3
name:
cabal-version: -any
license: AllRightsReserved
build-depends:
base -any
```

``` haskell
-- cabal-1.22.0.0
name:
cabal-version: -any
license: UnspecifiedLicense
```

Contributor guide

Open the contributing guide

Research direction

Start with the writePackageDescription call and reproduce the issue using the bnfcCabal example and its PackageDescription value. Compare the generated cabal files under Cabal 1.20.0.3 and 1.22.0.0, then determine whether the changed dependency output is a bug or reflects incorrect API usage. Done means the behavior is fixed or the correct usage is clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.