Cabal woes

Mikhail Glushenkov mikhail.glushenkov at gmail.com
Mon Apr 15 22:43:00 UTC 2019


Hello Simon,

On Mon, 15 Apr 2019 at 23:14, Simon Peyton Jones via ghc-devs
<ghc-devs at haskell.org> wrote:
>
> It is terribly mysterious that “cabal install hspec” doesn’t, well, install hspec.

In the cabal v2-* model [1] installing libraries globally is no longer
the recommended mode of operation, which is why you now need to pass
--lib to 'install' to do that.

There are now better alternatives for most use cases of 'install --lib':

* For just trying out some set of libraries in REPL, you can use
`cabal new-repl --build-depends=foo,bar,baz` outside of a project
instead of ghci. [2] If you have .ghc.environment file generation
turned on, you can also use plain ghci inside your project, and it
will pick up the project context. [3]
* For running Haskell scripts that expect extra libraries in the
global package DB you can use `#! cabal` instead of `#! runghc`. [4]

> It must surely be a bug that “cabal install –lib hspec” simply crashes.

This is a bug that we haven't fixed yet [5]. Should've just worked.


[1] https://cabal.readthedocs.io/en/latest/nix-local-build-overview.html
[2] https://cabal.readthedocs.io/en/latest/nix-local-build.html#cabal-v2-repl
[3] https://cabal.readthedocs.io/en/latest/nix-local-build.html#cfg-field-write-ghc-environment-files
[4] https://cabal.readthedocs.io/en/latest/nix-local-build.html#cabal-v2-run
[5] https://github.com/haskell/cabal/issues/5990


More information about the ghc-devs mailing list