[Haskell-cafe] Package Management with Stack?

Adam Bergmark adam at bergmark.nl
Sat Mar 11 12:21:14 UTC 2017


On Sat, 11 Mar 2017 at 01:38 Jun Inoue <jun.lambda at gmail.com> wrote:

> Thanks for the suggestion, Adam.  That does it for xmonad-contrib.
> Unfortunately, it fails when I go on to add xmonad-extras, probably
> because the version of xmonad already installed can't be resolved with
> the available version(s) of xmonad-extras.  (I forgot to note exactly
> which packages I had before, so I'm installing these things one by
> one, based on compilation errors of ~/.xmonad/xmonad.hs.)
>
>   $ stack install xmonad-extras hint-0.6.0 libmpd-0.9.0.6 --resolver
> lts-8.4
>
>   Error: While constructing the build plan, the following exceptions
> were encountered:
>
>   In the dependencies for xmonad-extras-0.12.1:
>       hint-0.6.0 must match >=0.3.3.3 && <0.5 (latest applicable is 0.4.3)
>       libmpd-0.9.0.6 must match >=0.8 && <0.9 (latest applicable is
> 0.8.0.5)
>       xmonad-0.13 must match >=0.10 && <0.13 (latest applicable is 0.12)
>       xmonad-contrib must match >=0.10 && <0.13, but the stack
> configuration has no specified version
>                      (latest applicable is 0.12)
>
>   Recommended action: try adding the following to your extra-deps in
> /home/jun/.stack/global-project/stack.yaml:
>   - xmonad-contrib-0.12
>
>   You may also want to try the 'stack solver' command
>   Plan construction failed.
>
> Adding the fact that I seem to have to list a lot of deps on the
> command line or in stack.yaml and Brandon's suggestion that I'm using
> this tool for the wrong purpose, this seems like a deal breaker for me
> :(
>
>
It's not that you are using the wrong tool, there is no tool that would let
you install incompatible versions together! (There is --allow-newer in
stack and cabal-install but then you are even less likely to end up with
something that works)

But once you get these mismatches I find cabal-install (in an empty
sandbox) easier to use for debugging:

```
$ cabal install xmonad xmonad-contrib xmonad-extras --dry
Resolving dependencies...
In order, the following would be installed (use -v for more details):
data-default-class-0.1.2.0
data-default-instances-containers-0.0.1
dlist-0.8.0.2
data-default-instances-dlist-0.0.1
extensible-exceptions-0.1.1.4
mtl-2.2.1
old-locale-1.0.0.7
data-default-instances-old-locale-0.0.1
data-default-0.7.1.1
X11-1.6.1.2 (latest: 1.8)
old-time-1.1.0.3
random-1.1
regex-base-0.93.2
regex-posix-0.95.2
setlocale-1.0.0.4
split-0.2.3.1
text-1.2.2.1
parsec-3.1.11
utf8-string-1.0.1.1
X11-xft-0.3.1
xmonad-0.12 (latest: 0.13)
xmonad-contrib-0.12 (latest: 0.13)
xmonad-extras-0.12.1
```

cabal-install always tries to pick the latest versions so this implies that
xmonad-extras can't use the latest xmonad & xmonad-contrib. So if you are
fine using older versions of those: there you go!

You can verify this further by adding constraints:

```
$ cabal install 'xmonad>=0.13' 'xmonad-contrib>=0.13' xmonad-extras --dry
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: xmonad-0.13 (user goal)
trying: base-4.9.1.0/installed-4.9... (dependency of xmonad-0.13)
next goal: xmonad-extras (user goal)
rejecting: xmonad-extras-0.12.1, xmonad-extras-0.12 (conflict: xmonad==0.13,
xmonad-extras => xmonad>=0.10 && <0.13)
rejecting: xmonad-extras-0.11 (conflict: xmonad==0.13, xmonad-extras =>
xmonad>=0.10 && <0.12)
rejecting: xmonad-extras-0.10.1.2, xmonad-extras-0.10.1.1,
xmonad-extras-0.10.1, xmonad-extras-0.10 (conflict: xmonad==0.13,
xmonad-extras => xmonad>=0.10 && <0.11)
rejecting: xmonad-extras-0.9.2, xmonad-extras-0.9.1 (conflict: xmonad==0.13,
xmonad-extras => xmonad>=0.9 && <0.10)
rejecting: xmonad-extras-0.9, xmonad-extras-0.0 (conflict:
base==4.9.1.0/installed-4.9..., xmonad-extras => base>=3 && <4 || <3)
Dependency tree exhaustively searched.
```

What you really want is some blessed combination of packages that work
together, and this is exactly what a stackage snapshot would give you if
these packages were all part of stackage...

But it's true that stack isn't a package manager and there is no active
effort within stackage to make as many executables as possible installable.


> On Sat, Mar 11, 2017 at 4:11 AM, Adam Bergmark <adam at bergmark.nl> wrote:
> > I use the global stack environment to install most executables, it works
> > best when the package is in a snapshot of course. There is no need to
> change
> > the global config, try this: stack install xmonad-contrib X11-xft-0.3.1
> > --resolver lts-8.4
> >
> >  You can also look for a stack.yaml in the repo of the executable and use
> > that resolver + any extra deps on the command line, that'll most likely
> work
> > even if the package isn't in a snapshot.
> >
> > HTH,
> > Adam
> >
> >
> > On Fri, 10 Mar 2017 at 18:56 Matt <parsonsmatt at gmail.com> wrote:
> >>
> >> Stack does have a notion of a global project, which it uses if you're
> not
> >> in a project directory. The error message you received:
> >>
> >>   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
> >>
> >> tells you how to make X11-xft-0.3.1 available to the global project,
> which
> >> should allow you to install xmonad-contrib into this global package.
> >>
> >> Matt Parsons
> >>
> >> On Fri, Mar 10, 2017 at 10:33 AM, Brandon Allbery <allbery.b at gmail.com>
> >> wrote:
> >>>
> >>>
> >>> On Fri, Mar 10, 2017 at 12:28 PM, Jun Inoue <jun.lambda at gmail.com>
> wrote:
> >>>>
> >>>> Am I fundamentally misunderstanding how stack is supposed to be used?
> >>>
> >>>
> >>> Stack is not a package manager. It is a reproducible builds tool. Ad
> hoc
> >>> usage like you are doing is outside of its purview.
> >>>
> >>> Also, last I checked, for some reason xmonad-contrib wasn't in
> stackage,
> >>> so stack's primary mechanism for avoiding conflicts fails.
> >>>
> >>> --
> >>> brandon s allbery kf8nh                               sine nomine
> >>> associates
> >>> allbery.b at gmail.com
> >>> ballbery at sinenomine.net
> >>> unix, openafs, kerberos, infrastructure, xmonad
> >>> http://sinenomine.net
> >>>
> >>> _______________________________________________
> >>> Haskell-Cafe mailing list
> >>> To (un)subscribe, modify options or view archives go to:
> >>> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> >>> Only members subscribed via the mailman list are allowed to post.
> >>
> >>
> >> _______________________________________________
> >> Haskell-Cafe mailing list
> >> To (un)subscribe, modify options or view archives go to:
> >> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> >> Only members subscribed via the mailman list are allowed to post.
> >
> >
> > _______________________________________________
> > Haskell-Cafe mailing list
> > To (un)subscribe, modify options or view archives go to:
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> > Only members subscribed via the mailman list are allowed to post.
>
>
>
> --
> Jun Inoue
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170311/356e6991/attachment.html>


More information about the Haskell-Cafe mailing list