给定一个 Haskell 项目,有没有办法自动计算整个依赖项列表?它依赖的所有库以及已包含但不需要的库。
问问题
1338 次
1 回答
8
正如我在评论中所说,cabal-install 已经通过模块查找(如 GHCi)猜测包来做到这一点(我正在使用 cabal-install 0.14.0)。它没有任何真正的智能 wrt 版本,因此它只是将版本设置为与您安装的主要版本相匹配。
下面你可以看到我制作了一个虚拟包,它导入Data.Vector
和 cabal-install 推断我正在使用向量 0.9.*。
[tommd@mavlo blah]$ pwd
/tmp/blah
[tommd@mavlo blah]$ cat Data/Blah.hs
module Data.Blah where
import Data.Vector
[tommd@mavlo blah]$ cabal init
Package name? [default: blah]
...SNIP...
What does the package build:
1) Library
2) Executable
Your choice? 1
Include documentation on what each field means (y/n)? [default: n]
Guessing dependencies... <--- SEE, SEE! YAY!
Generating LICENSE...
Warning: unknown license type, you must put a copy in LICENSE yourself.
Generating Setup.hs...
Generating blah.cabal...
You may want to edit the .cabal file and add a Description field.
[tommd@mavlo blah]$ cat blah.cabal
-- Initial blah.cabal generated by cabal init. For further documentation,
-- see http://haskell.org/cabal/users-guide/
name: blah
version: 0.1.0.0
synopsis: Sisponys
-- description:
-- license:
license-file: LICENSE
author: Me
maintainer: No@No.No
-- copyright:
-- category:
build-type: Simple
cabal-version: >=1.8
library
exposed-modules: Data.Blah
-- other-modules:
build-depends: base ==4.5.*, vector ==0.9.* <-- SEE?? SEE! YIPPEE!!
于 2012-05-17T05:05:29.757 回答