Dependencies from .cabal files

Erik de Castro Lopo mle+hs at mega-nerd.com
Wed Jul 1 07:49:02 EDT 2009


I'm subscribed, so please reply to the list.

Duncan Coutts wrote:

> It sounds like you want to select a particular valid configuration in
> which case you should use finalizePackageDescription.

I actually did try finalizePackageDescription before flattenPackageDescription
but I couldn't get it to typecheck. My attempt looked like this:


    import qualified Distribution.System as DS
    import qualified Distribution.Compiler as DC

    finalize :: GenericPackageDescription -> PackageDescription
    finalize generic = do
        let compiler = DC.CompilerId DC.GHC (Version [6, 10, 3] [])
        let flags = [(FlagName "splitBase", True)]
        let r = finalizePackageDescription flags Nothing DS.Linux DS.I386 compiler [] generic
        case r of
            Left _ -> error $ show r
            Right (d, _) -> d


which resulted in:

    Ambiguous type variable `pkg' in the constraint:
      `Package pkg'
        arising from a use of `finalizePackageDescription'
                     at cabal2debian.hs:91:12-88
    Probable fix: add a type signature that fixes these type variable(s)

and unfortunately, my Haskell foo is not yet strong enough to figure this
one out.

> So you need to decide what you mean by getting dependencies. The method
> you use depends crucially on your purpose with the data.

Ok, since I'm trying to generate a Debian package metadata from the Cabal
metadata, finalize is definitely what I want. That just leaves me with 
this type checking problem.

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



More information about the cabal-devel mailing list