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?
A package is a library of Haskell modules known to the compiler. GHC comes with several packages: see the accompanying library documentation. More packages to install can be obtained from HackageDB.
By default stack installs packages to ~/. cabal and ~/. ghc in your home directory.
The syntax for importing modules in a Haskell script is import <module name>. This must be done before defining any functions, so imports are usually done at the top of the file. One script can, of course, import several modules. Just put each import statement into a separate line.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With