Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cabal - how to install specific version of package

Tags:

haskell

cabal

I need for example a minor version of a package, for example persistent-postgresql .. or hdbc-mysql or whatever.

If I run

cabal install persistent-postgresql

it will install persistent-postgresql version 1.3 and then I get the error 'At least the following dependencies are missing: persistent-postgresql >= 1.2 && < 1.3' That's why I would like to install an earlier version of this package to make it work. Or maybe there is another solution?

Thanks in advance.

like image 442
Steffi Avatar asked Jan 07 '14 08:01

Steffi


People also ask

How do I download a specific version of a package?

Use npm list [package-name] to know the specific latest version of an installed package. Use npm install [package-name]@[version-number] to install an older version of a package. Prefix a version number with a caret (^) or a tilde (~) to specify to install the latest minor or patch version, respectively.

Where are cabal packages installed?

Using Cabal By default stack installs packages to ~/. cabal and ~/. ghc in your home directory.

What is the difference between stack and cabal?

Stack supports creating projects using templates. It also supports your own custom templates. Stack has built-in hpack support in it. It provides an alternative (IMO, a better) way of writing cabal files using yaml file which is more widely used in the industry.


1 Answers

You should probably try to cabal install the package that actually depends on persistent-postgresql as cabal will then try to select the right version automatically.

However if you do need to do this, a simple way is:

cabal install persistent-postgresql-1.2.1.3

Or more complicated:

cabal install persistent-postgresql --constraint 'persistent-postgresql < 1.3'

Here you can just keep specifying that you want something earlier than a particular version as things don't work without needing to know the exact next version down. You can also place constraints on other packages if necessary.

like image 158
GS - Apologise to Monica Avatar answered Sep 17 '22 14:09

GS - Apologise to Monica