Dependencies from .cabal files

Erik de Castro Lopo mle+hs at mega-nerd.com
Tue Jun 30 07:41:45 EDT 2009


Hi all,

I hope this is the right list to ask this. Please direct me to the
right place if not.

Anyway, I'm using functionality in the Distribution.* namespace to
parse .cabal files retrieved from Hackage. The problem is that 
after using flattenPackageDescription, the buildDepends of the
PackageDescription structure seems to be a flat list which seems
to lose information that was in the original .cabal file.

For instance, the cabal file for hoogle, contains:

    build-depends: parsec, filepath, safe, uniplate, mtl, time
    if flag(splitBase)
        build-depends: base >= 3, directory, process, containers, array, bytestring
    else
        build-depends: base < 3

while the buildDepends list looks like this:

    Dependency (PackageName "base") (EarlierVersion
                      (Version {versionBranch = [3], versionTags = []})),
    Dependency (PackageName "bytestring") AnyVersion,
    Dependency (PackageName "array") AnyVersion,
    Dependency (PackageName "containers") AnyVersion,
    Dependency (PackageName "process") AnyVersion,
    Dependency (PackageName "directory") AnyVersion,
    Dependency (PackageName "base") (UnionVersionRanges
            (ThisVersion (Version {versionBranch = [3], versionTags = []})) 
            (LaterVersion (Version {versionBranch = [3], versionTags = []}))),
    Dependency (PackageName "time") AnyVersion,
    Dependency (PackageName "mtl") AnyVersion,
    Dependency (PackageName "uniplate") AnyVersion,
    Dependency (PackageName "safe") AnyVersion,
    Dependency (PackageName "filepath") AnyVersion,
    Dependency (PackageName "parsec") AnyVersion

Should the conversion from .cabal file to Dependency list be lossy?

I look forward to enlightenment.

Cheers,
Erik
-- 
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/



More information about the cabal-devel mailing list