开发者

Which versions of packages can my Haskell package depend upon?

I'm nearly ready to upload my first package to Hackage!

I have this in my hstest.cabal:

Executable hstest
        Main-Is:        hstest.hs
        Build-Depends:  base, mtl, directory, ghc, ghc-paths, random, QuickCheck

I understand that it's bad form to simply list which packages my package depends upon; instead I should state which versions of these packages are needed.

The versions I have installed are

  • base = 4.1.0.0
  • mtl = 1.1.0.2
  • directory = 1.0.0.3
  • ghc = 6.10.3
  • ghc-paths = 0.1.0.5
  • random = 1.0.0.1
  • QuickCheck = 1.2.0.0

Is there an easy way of finding out what the earliest acceptable versions of each of these packages my package actually needs? (i.e. without installing lots of obsolete versions and testing them o开发者_如何学Pythonne by one?)

Which future versions of these packages can I assume my package can depend on?


Is there an easy way of finding out what the earliest acceptable versions of each of these packages my package actually needs

No, there's no tool for that.

Which future versions of these packages can I assume my package can depend on?

The safest way is to follow the package versioning policy, which says to only rely on API-extending versions of packages. That is versions of the form: A.B.*. As the policy states:

To minimize breakage when new package versions are released, you can use dependencies that are insensitive to minor version changes (e.g. foo >= 1.2.1 && < 1.3).

So you would do something like:

 QuickCheck >= 1.2 && < 1.3

Now, testing may reveal lower or higher bounds on what features you actually use.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜