dave4420
dave4420

Reputation: 47062

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

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 one by one?)

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

Upvotes: 7

Views: 170

Answers (1)

Don Stewart
Don Stewart

Reputation: 137987

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.

Upvotes: 5

Related Questions