Thanks.
_______________________________________________
Haskell-Cafe mailing list
Haskel...@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
On Sat, Jun 13, 2009 at 10:22 PM, Magicloud Magiclouds wrote:
> Hi,
> 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?
>
> Thanks.
Not really. The easiest way is to just build your code and add every
package Cabal complains about being hid into your build-depends.
(Usually this won't take more than a minute or 3 if you're toggling
between a terminal and an editor.)
- --
gwern
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEAREKAAYFAko0arEACgkQvpDo5Pfl1oJbNACfYNB+oScSsiwF3qwZMHzu3AjM
s24An3tcamliH1rJzZiNg1EqjTLLYzzo
=7Fgw
-----END PGP SIGNATURE-----
Someone really ought to write a tool for this...
--
Deniz Dogan
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
c:/ghc/ghc-6.10.3\package.conf:
base-3.0.3.1, base-4.1.0.0
ghc-pkg find-module Data.Map
c:/ghc/ghc-6.10.3\package.conf:
containers-0.2.0.1
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?-)
Claus
TYPE SIGNATURES
numbersTests :: Test
testAverage :: Test
testBindInt :: Test
TYPE CONSTRUCTORS
Dependent modules: [(MoresmauJP.Util.Numbers, False)]
Dependent packages: [HUnit-1.2.0.3, base, ghc-prim, integer]
It is, however, available only after your code has successfully compiled.
Best regards
Krzysztof Skrzętnicki
On Sun, Jun 14, 2009 at 6:05 AM, Deniz Dogan wrote:
> Someone really ought to write a tool for this...
Well, it's an issue of time. Just building and adding the deps is fast
and straightforward. A tool I'd need to know about, have installed,
and remember to use in the middle of a Cabalizing session. The people
who most need such a tool are those who are least likely to use it.
And given the overhead, it's unclear that it would actually save time.
Sometimes, somethings aren't worth automating.
Now, if someone were to create such a tool and integrate it into
'mkcabal', then it might make sense. You could create the basic .cabal
with the build-depends filled in. But as a separate tool it's too
small a task to handle. Even memorizing the -show-iface or
- -ddump-types options may not be worthwhile - how often does one create
Cabal packages from scratch?
- --
gwern
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEAREKAAYFAko1BWEACgkQvpDo5Pfl1oKvigCeO7ABRVr/9+kT62dIFpo0k5+f
y/AAnR6wLaDpX5/lZPqQzB/Wb4kuj8i9
=L2iA
-----END PGP SIGNATURE-----
I'm sorry, I was not aware of those flags when I wrote my message. You're right.
--
Deniz Dogan
> 2009/6/14 Gwern Branwen <gwe...@gmail.com>:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA512
>>
>> On Sat, Jun 13, 2009 at 10:22 PM, Magicloud Magiclouds wrote:
>>> Hi,
>>> 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?
>>>
>>> Thanks.
>>
>> Not really. The easiest way is to just build your code and add every
>> package Cabal complains about being hid into your build-depends.
>> (Usually this won't take more than a minute or 3 if you're toggling
>> between a terminal and an editor.)
>>
>> - --
>> gwern
>
> Someone really ought to write a tool for this...
Visualising the Haskell Universe � Control.Monad.Writer