[Haskell-cafe] Package Management with Stack?

Jun Inoue jun.lambda at gmail.com
Fri Mar 10 17:28:12 UTC 2017


I've gotten fed up with Cabal+Hackage build errors and I want a more
stable way to manage Haskell packages.  I'm NOT trying to build a
Haskell project of my own, but I just want a system-wide (or at least
user-wide) installation of GHC "with batteries", along with some
Haskell programs that other people have written.  I need xmonad
installed somewhere on my $PATH and I need lens available with
:m+ when I fire up ghci.  I do NOT want a bunch of sandboxes scattered
throughout my file system, some of which have these things installed
while others don't.

I was hoping Stack+Stackage would fit that bill, but going through the
instructions on https://haskell-lang.org/get-started, it seems that
stack is meant really for setting up sandboxes for particular
projects.  When I tried using it as a system-wide (or rather,
user-wide) package manager, it fails.  For instance, as suggested on
that page, I created /tmp/HelloWorld.hs and type

$ stack HelloWorld.hs

which seemed to successfully download the lts-8.4 build plan and
ghc-nopie-8.0.2.  So far so good.  But then when I typed

$ stack install xmonad-contrib

it said

  Error: While constructing the build plan, the following exceptions
  were encountered:

  In the dependencies for xmonad-contrib-0.13:
      X11-xft must match >=0.2, but the stack configuration has no
      specified version (latest applicable is 0.3.1)

  Recommended action: try adding the following to your extra-deps in
  /home/jun/.stack/global-project/stack.yaml:
  - X11-xft-0.3.1

  You may also want to try the 'stack solver' command
  Plan construction failed.

I've tried going down the "stack solver" rabbit hole, to no avail; it
just tells me I need to register a directory containing a .cabal file.
IIUC, that's a directory containing some project I'm developing?  But
I have no such project!  (At the moment.)

Am I fundamentally misunderstanding how stack is supposed to be used?
Is stack usable as a package manager in the way cabal sort of was, and
in the way apt-get or emerge can be used?  If not, what do people
recommend I use for that purpose?  Nix?  Or, perhaps, do the errors
above indicate misconfiguration?

I don't want to install haskell-platform because it's too outdated.  I
need at least GHC >= 8.  I'm on the latest stable release of Ubuntu if
that makes a difference.

-- 
Jun Inoue


More information about the Haskell-Cafe mailing list