Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

escape from cabal hell with haste, binary and zip-archive

I'd like to use the haste-compiler package to do the haskell-to-javascript thing:

jsnavely@beefy:~/project$ cabal install haste-compiler
Resolving dependencies...
...
Configuring zip-archive-0.2.3...
Building zip-archive-0.2.3...
Preprocessing library zip-archive-0.2.3...
[1 of 1] Compiling Codec.Archive.Zip ( src/Codec/Archive/Zip.hs, dist/build/Codec/Archive/Zip.o )

src/Codec/Archive/Zip.hs:163:27: Not in scope: `decodeOrFail'
Failed to install zip-archive-0.2.3
cabal: Error: some packages failed to install:
haste-compiler-0.3 depends on zip-archive-0.2.3 which failed to install.
zip-archive-0.2.3 failed during the building phase. The exception was:
ExitFailure 1

I noticed that there is a newer version of zip-archive that bumped the version of binary to >= 0.7, which supplies the decodeOrFail function. So I tried checking out the haste-compiler repo and bumping the zip-archive version to the new zip-archive 0.2.3.2. But that doesn't help:

jsnavely@beefy:~/project/haste-compiler$ cabal install
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: haste-compiler-0.3 (user goal)
trying: zip-archive-0.2.3.2/installed-208... (dependency of
haste-compiler-0.3)
trying: ghc-7.6.3/installed-0d1... (dependency of haste-compiler-0.3)
next goal: bin-package-db (dependency of ghc-7.6.3/installed-0d1...)
rejecting: bin-package-db-0.0.0.0/installed-837... (conflict: zip-archive =>
binary==0.7.1.0/installed-961..., bin-package-db =>
binary==0.5.1.1/installed-5b8...)
Dependency tree exhaustively searched.

I also tried manually installing zip-archive, and binary, and doing all this in a sandbox. I don't know what to do - I'd really like to replace all my javascript with well-typed haskelly goodness. I experience the same problem on my macbookpro and my linux box, both running the latest haskell-platform, ghc version 7.6.3

like image 958
nont Avatar asked Jun 21 '14 02:06

nont


1 Answers

Your dependency tree looks sort of like this:

                      ┌────────────────────┐
            ┌─────────┤ haste─compiler─0.3 │
            │ depends └─────────────────┬──┘
            V                           │
      ┌───────────┐                     │ depends
      │ ghc─7.6.3 │                     │
      └─────┬─────┘                     V                   
            │ depends                ┌─────────────────────┐
            V                        │ zip─archive─0.2.3.2 │
┌────────────────────────┐           └───────────┬─────────┘
│ bin─package─db─0.0.0.0 │                       │
└───────────┬────────────┘                       │ depends
            │ depends                            │
            V                                    V
    ┌────────────────┐  conflicts with  ┌────────────────┐
    │ binary─0.5.1.1 │<────────────────>│ binary─0.7.1.0 │
    └────────────────┘                  └────────────────┘

Since it’s likely infeasible for you to reinstall GHC, and so it and everything below it are ‘fixed in place’ for us, we’ll have to try to change zip-archive-0.2.3.2 and binary-0.7.1.0. Let’s look at the constraints of haste-compiler-0.3:

zip-archive

So it doesn’t specify a version at all. Any will do. If we look at previous versions of zip-archive, we see that version 0.2.2.1 is the earliest version that has a constraint on binary compatible with the installed binary-0.5.1.1 that also built on Hackage. So here’s how you should resolve it:

  1. Unregister zip-archive-0.2.3.2 and binary-0.7.1.0 in that order:

    % ghc-pkg unregister zip-archive-0.2.3.2
    % ghc-pkg unregister binary-0.7.1.0
    
  2. Delete those two packages from your GHC library directory. This varies depending on your installation, but take a look in ~/.ghc, ~/.cabal, and ~/Library/Haskell for a lib directory (possibly within a subdirectory or two) and see if you can find the packages in there somewhere.

  3. Install haste-compiler-0.3 with a constraint on the zip-archive version:

    % cabal install --constraint='zip-archive==0.2.2.1' haste-compiler==0.3
    

That should work, but I haven’t tried it myself, so it could go wrong.

like image 110
icktoofay Avatar answered Oct 07 '22 22:10

icktoofay