mntk123
mntk123

Reputation: 955

haskell cabal sandbox how to install packages?

I wish if someone tells me the steps required to install gloss-examples in a sandbox along with all its dependencies. Here is what I tried to do:

I downloaded the gloss-examples package from hackage.

When I ran the command, after changing into the ~/gloss/gloss-examples-1.9.4.1

~/gloss/gloss-examples-1.9.4.1$cabal sandbox init

it succeeded, so I issued the command

~/gloss/gloss-examples-1.9.4.1$cabal install --only-dependencies

but then I got the following errors:

Resolving dependencies...
cabal: Could not resolve dependencies:
trying: gloss-examples-1.9.4.1 (user goal)
next goal: base (dependency of gloss-examples-1.9.4.1)
rejecting: base-4.5.0.0/installed-c8e... (conflict: gloss-examples =>
base==4.8.*)
rejecting: base-4.8.1.0, base-4.8.0.0, base-4.7.0.2, base-4.7.0.1,
base-4.7.0.0, base-4.6.0.1, base-4.6.0.0, base-4.5.1.0, base-4.5.0.0,
base-4.4.1.0, base-4.4.0.0, base-4.3.1.0, base-4.3.0.0, base-4.2.0.2,
base-4.2.0.1, base-4.2.0.0, base-4.1.0.0, base-4.0.0.0, base-3.0.3.2,
base-3.0.3.1 (constraint from non-upgradeable package requires installed
instance)
Dependency tree exhaustively searched.

Note: when using a sandbox, all packages are required to have consistent
dependencies. Try reinstalling/unregistering the offending packages or
recreating the sandbox.

How do I install this package gloss-examples and all its dependencies in the sandbox directory only? I think I understand that cabal sandbox allows you to install any arbitrary package with all dependencies (some or all them conflicting with globally installed packages) installed in a separate directory. Is this even possible? I think I am missing something. Is this a right use-case for cabal sandbox? Seeing the following

Note: when using a sandbox, all packages are required to have consistent dependencies.

Is there a difference between conflicting dependencies and not consistent dependencies?

I tried many tutorials including this but could not understand how to use cabal sandbox.

Upvotes: 2

Views: 2151

Answers (1)

dfeuer
dfeuer

Reputation: 48611

It appears to me that you have downloaded a version of gloss-examples that is not compatible with your version of the base library. There are two ways to fix this:

  1. Download a version (presumably an older one) that is compatible with your base library. The contents page for the package on Hackage has a long list of available versions near the top. It may also be possible to use cabal fetch to do this—I'm not sure.

  2. Upgrade GHC to get a newer base. You generally cannot upgrade base without upgrading GHC.

Upvotes: 2

Related Questions