– version 18.104.22.168.
curl -f https://downloads.haskell.org/~ghcup/0.1.9/i386-linux-ghcup-0.1.9 > ~/ghcup chmod +x ~/ghcup
Then to install cabal it is a simple matter of
~/ghcup install cabal 22.214.171.124
The binary that it installs will end up at
~/.ghcup/bin/cabal-126.96.36.199 and a symlink to it will probably be created at
For very quick exploration you can specify a dependency on the command line. If you want something that is a little more persistent you can create a temporary project and add it as a dependency.
In a directory that doesn’t contain a Haskell package’s
.cabal file (perhaps your home directory) run
cabal v2-repl --build-depends QuickCheck <it downloads and builds QuickCheck if necessary...> *Main> import Test.QuickCheck *Main Test.QuickCheck> let prop h t = (length t + 1) == (length $ h:t) *Main Test.QuickCheck> quickCheck prop +++ OK, passed 100 tests.
$ mkdir my-temporary-package $ cd my-temporary-package $ cabal init
my-temporary-package.cabal to change
build-depends: base >=... && <...
build-depends: base, QuickCheck
(The constraints on base are going to cause you more harm than good for a quick exploratory project. You can add them back later if it becomes necessary.)
$ cabal v2-repl
cabal install --lib?
I would avoid it. To me it seems like a fools errand to try to load non-system packages with anything but
Suppose I have a package called
package1 in a local source directory and whose cabal file is at
/home/me/package1/package1.cabal; I want to use it in another local package I’m developing whose cabal file is
I achieve this by adding an
optional-packages stanza to
cabal.project, as follows.
/home/me/package2/cabal.project already exists
just add the following line
/home/me/package2/cabal.project does not yet exist
/home/me/package2/cabal.project containing the following
packages: *.cabal optional-packages: /home/me/package1/package1.cabal
It is vital that the “
packages: *.cabal” line be included otherwise your project defaults to containing no packages at all. This default doesn’t seem to make any sense, but there it is.
cabal install --libdoesn’t seem to work
cabal install --lib seems like it ought to support use cases like this, I’ve never been able to get it to work.