[Haskell-cafe] How to know the build dependencies?

Claus Reinke claus.reinke at talk21.com
Sun Jun 14 06:24:44 EDT 2009

>  I am learning to use cabal for my code.
>  Just when I start, I met a question, is there an easy way to find
> out what packages my code depends?

If you've managed to get your code to compile,

    ghc --show-iface Main.hi

is perhaps the easiest way (ghc --make and ghci will also report 
package dependencies as they encounter them).

If you're looking for the package for a particular module, ghc-pkg
can help

    ghc-pkg find-module Control.Concurrent
        base-, base-

    ghc-pkg find-module Data.Map

If you're looking for a minimal set of imports before hunting for 
packages, ghc's -ddump-minimal-imports will create a file Main.imports 
with that information. You could then run ghc-pkg find-module over
that list.

These are not the only options. Perhaps the available tools 
need to be advertized more?-)


More information about the Haskell-Cafe mailing list