鉴于Haskell项目,有没有办法自动计算整个依赖项列表?它所依赖的所有库以及已包含但不是必需的库。
答案 0 :(得分:8)
正如我在评论中所说,cabal-install已经通过模块查找(如GHCi)猜测包来实现这一点(我使用的是cabal-install 0.14.0)。它没有任何真正的情报w.r.t.版本,所以它只是将版本设置为您已安装的匹配主要版本。
下面你可以看到我制作一个导入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!!