Newbie question regarding dependencies

49 views
Skip to first unread message

Matthias Pronk

unread,
Apr 6, 2015, 7:17:41 AM4/6/15
to snap_fr...@googlegroups.com
Hi all,

After working my way through RWH, I would like to try if I'm able to use Haskell to build some more real world applications. So, I've decided to try to build a web application using Snap.

However, I already get in "Cabal hell" when I try to combine some libraries, notably:
Snap 0.9.5.0, snaplet-persistent, persistent-postgresql and digestive-functors{-snap,-heist}.

Using a Cabal sandbox with Stackage, Cabal tells me that it could not resolve the dependencies and that the dependency tree has been exhaustively searched (GHC 7.10.1 and Cabal 1.22.2.0, but I've also tried GHC 7.8.3 first). Using a Cabal sandbox without Stackage, Cabal tells me the backjump limit has been reached (when trying to install dependency digestive-functors-heist).

I've tried a Cabal sandbox, Stackage, Nix (which I couldn't get to work) and the Haskell Docker instance all with various versions of GHC and Cabal.

Either, I'm doing something wrong, or these libraries are not often used together.
What should I do to resolve these kind of problems?
How are the Snap people doing their development?
Which kind of libraries are recommended?
Should I ask package maintainers to up the version bounds?
But, which package has the most restrictive boundaries? How do I find this out?

Thank you for your time.

Kind regards,
- Matthias

MightyByte

unread,
Apr 6, 2015, 10:03:19 AM4/6/15
to snap_fr...@googlegroups.com
On Mon, Apr 6, 2015 at 5:22 AM, Matthias Pronk <mas...@gmail.com> wrote:
> Hi all,
>
> After working my way through RWH, I would like to try if I'm able to use
> Haskell to build some more real world applications. So, I've decided to try
> to build a web application using Snap.
>
> However, I already get in "Cabal hell" when I try to combine some libraries,
> notably:
> Snap 0.9.5.0, snaplet-persistent, persistent-postgresql and
> digestive-functors{-snap,-heist}.
>
> Using a Cabal sandbox with Stackage, Cabal tells me that it could not
> resolve the dependencies and that the dependency tree has been exhaustively
> searched (GHC 7.10.1 and Cabal 1.22.2.0, but I've also tried GHC 7.8.3
> first). Using a Cabal sandbox without Stackage, Cabal tells me the backjump
> limit has been reached (when trying to install dependency
> digestive-functors-heist).
>
> I've tried a Cabal sandbox, Stackage, Nix (which I couldn't get to work) and
> the Haskell Docker instance all with various versions of GHC and Cabal.
>
> Either, I'm doing something wrong, or these libraries are not often used
> together.

It's not that they're not often used together. It's more about the
fact that the ecosystem is fast-moving. There are a number of what I
would call "core" libraries that will usually be updated quite
promptly. But there are a number of other "satellite" libraries that
tend to be updated lazily.

> What should I do to resolve these kind of problems?

First of all, we need more detailed information about precisely what
you did and what error you are encountering. Did you use the "snap
init" template application? Did you install snap first? Did you use
a sandbox? What OS and GHC versions are you using? Etc etc...

> How are the Snap people doing their development?
> Which kind of libraries are recommended?
> Should I ask package maintainers to up the version bounds?

Absolutely. Speaking for myself, it's difficult to keep track of all
the libraries I maintain, so issues notifying me of problems--or
better yet, pull requests--are always welcome.

> But, which package has the most restrictive boundaries? How do I find this
> out?

When I run into dependency problems that are not obvious, one of the
first things I usually do is build with "cabal install -v3". This
usually points me to the root of the problem much more quickly.

> Thank you for your time.
>
> Kind regards,
> - Matthias
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Snap Framework" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to snap_framewor...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Matthias Pronk

unread,
Apr 7, 2015, 3:51:56 PM4/7/15
to snap_fr...@googlegroups.com
First, thank you for your response.

Op maandag 6 april 2015 16:03:19 UTC+2 schreef mightybyte:
[snip]
> What should I do to resolve these kind of problems?

First of all, we need more detailed information about precisely what
you did and what error you are encountering.  Did you use the "snap
init" template application?  Did you install snap first?  Did you use
a sandbox?  What OS and GHC versions are you using? Etc etc...


I'm running Debian Jessie, but I've installed a binary GHC installation in /usr/local and custom compiled Cabal in my Home.
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.8.4
$ cabal --version
cabal-install version 1.22.2.0
using version 1.22.2.0 of the Cabal library

I'm using a Cabal sandbox:
$ cabal sandbox init
$ cabal install snap
$ snap init

Then I add the following dependencies to the project_name.cabal:
    digestive-functors,
    digestive-functors-snap,
    digestive-functors-heist,
    persistent,
    persistent-postgresql,
    persistent-template

Then I try to install them with:
$ cabal install --dependencies-only

Which eventually rusults in:
...
next goal: digestive-functors-heist (dependency of foo-0.1)
rejecting: digestive-functors-heist-0.8.6.1, 0.8.6.0, 0.8.5.0, 0.8.4.1,
0.8.4.0, 0.8.3.1, 0.8.3.0, 0.8.1.0, 0.8.0.0, 0.7.0.0, 0.6.2.1, 0.6.2.0,
0.6.1.0 (conflict: blaze-builder==0.4.0.1/installed-5ec...,
digestive-functors-heist => blaze-builder>=0.3 && <0.4)
rejecting: digestive-functors-heist-0.6.0.0, 0.5.1.1 (conflict:
heist==0.14.1/installed-0db..., digestive-functors-heist => heist>=0.10.2 &&
<0.11)
rejecting: digestive-functors-heist-0.5.1.0 (conflict:
heist==0.14.1/installed-0db..., digestive-functors-heist => heist>=0.10 &&
<0.11)
rejecting: digestive-functors-heist-0.5.0.0, 0.4.0.0, 0.3.1.0, 0.3.0.1,
0.3.0.0 (conflict: heist==0.14.1/installed-0db..., digestive-functors-heist =>
heist>=0.8 && <0.9)
Backjump limit reached (change with --max-backjumps).
...


 
> How are the Snap people doing their development?
> Which kind of libraries are recommended?
> Should I ask package maintainers to up the version bounds?

Absolutely.  Speaking for myself, it's difficult to keep track of all
the libraries I maintain, so issues notifying me of problems--or
better yet, pull requests--are always welcome.


OK, good to know this.
 
> But, which package has the most restrictive boundaries? How do I find this
> out?

When I run into dependency problems that are not obvious, one of the
first things I usually do is build with "cabal install -v3".  This
usually points me to the root of the problem much more quickly.

 
I've tried cabal install -v3, but it's resulting in massive output of 7.7M, showing all package versions that Cabal has tried, but not really enlightening to me.

Kind regards,
- Matthias

Matthias Pronk

unread,
Apr 7, 2015, 4:12:44 PM4/7/15
to snap_fr...@googlegroups.com
Oops, just found out that it can find the dependencies correctly when I increase the backjumps to 5000. Would be nice if Cabal would suggest a new number of backjumps, and at least show the current number of backjumps used.

Is this the way people solve these kind of problems?



Op dinsdag 7 april 2015 21:51:56 UTC+2 schreef Matthias Pronk:

Daniel Patterson

unread,
Apr 7, 2015, 4:34:41 PM4/7/15
to snap_fr...@googlegroups.com
There have been issues with cabal's solver (including some bugs; I
think those were resolved - see
https://github.com/haskell/cabal/issues/1855).

For a while, at least for me, it could only figure things out with
'--reorder-goals'. I think that particular bug was fixed, but
obviously things are still not optimal. If you are having trouble,
that option could possibly help. Also, provided things are building,
'cabal freeze' can create a safe state of dependencies.

Will Langstroth

unread,
Apr 19, 2015, 10:48:08 AM4/19/15
to snap_fr...@googlegroups.com
On Tuesday, April 7, 2015 at 4:34:41 PM UTC-4, Daniel Patterson wrote:
For a while, at least for me, it could only figure things out with
'--reorder-goals'. I think that particular bug was fixed, but
obviously things are still not optimal. 

Just in case anyone else arrives here with the same issue, the '--reorder-goals' flag is very likely to solve your problem if you're using an older version of cabal.

Julian Birch

unread,
Apr 19, 2015, 7:23:55 PM4/19/15
to snap_fr...@googlegroups.com
Just an observation: it's often a lot easier to just run with LTS Haskell than solve cabal hell. Especially if you're a beginner and not particularly minor-version sensitive.
--

---
You received this message because you are subscribed to the Google Groups "Snap Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to snap_framewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Sent from an iPhone, please excuse brevity and typos.

Matthias Pronk

unread,
Apr 20, 2015, 3:18:01 AM4/20/15
to snap_fr...@googlegroups.com
Yes, for me it even solved my problem using the latest Cabal (1.22.0.1 at the moment).

By the way, after I've encountered this problem I've submitted an issue and a PR[1] to Cabal to have the error message mention about the '--reorder-goals' flag. The PR has been accepted, so in the future this will hopefully be easier to resolve for newbies like me.

Thank you all for your answers!

Kind regards,
- Matthias




Op zondag 19 april 2015 16:48:08 UTC+2 schreef Will Langstroth:
Reply all
Reply to author
Forward
0 new messages