0
votes

I'm pretty new to Haskell, and trying to install Yesod with Cabal, but I'm running into this compilation error:

cabal install yesod --force-reinstalls


Network/Wai/Parse.hs:106:61:
    No instance for (Control.Monad.Trans.Resource.Internal.MonadThrow
                       (ConduitM S8.ByteString Void IO))
      arising from a use of `allocate'
    Possible fix:
      add an instance declaration for
      (Control.Monad.Trans.Resource.Internal.MonadThrow
         (ConduitM S8.ByteString Void IO))
    In the second argument of `($)', namely
      `allocate
         (do { tempDir <- getTmpDir;
               openBinaryTempFile tempDir pattern })
         (\ (_, h) -> hClose h)'
    In a stmt of a 'do' block:
      (key, (fp, h)) <- flip runInternalState internalState
                        $ allocate
                            (do { tempDir <- getTmpDir;
                                  openBinaryTempFile tempDir pattern })
                            (\ (_, h) -> hClose h)
    In the expression:
      do { (key, (fp, h)) <- flip runInternalState internalState
                             $ allocate
                                 (do { tempDir <- getTmpDir;
                                       openBinaryTempFile tempDir pattern })
                                 (\ (_, h) -> hClose h);
           _ <- runInternalState (register $ removeFile fp) internalState;
           CB.sinkHandle h;
           lift $ release key;
           .... }
Failed to install wai-extra-2.0.2

This is the full output when installing

I'm using the latest Haskell Platform with the ghc-clang-wrapper script.

Cabal versions:

$ cabal --version
cabal-install version 1.16.0.2
using version 1.16.0 of the Cabal library

GHC version:

$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.6.3

Some of the tutorials mention using a cabal sandbox, but my version of cabal (1.16) is too old for that. If the sandbox is likely too help I'll try and get that working (had a little trouble updating cabal to 1.18).

1

1 Answers

0
votes

It looks like you have several modules which when installed beside existing modules cause name collisions. Further up in the output before the error you posted there are a bunch of errors like this:

Network/HTTP/Client/Conduit.hs:37:9:
   Ambiguous occurrence `MonadResource'
   It could refer to either `Data.Conduit.MonadResource',
    imported from `Data.Conduit' at Network/HTTP/Client/Conduit.hs:13:1-19
    (and originally defined in `resourcet-0.4.10:Control.Monad.Trans.Resource.Internal')
   or `Control.Monad.Trans.Resource.MonadResource',
    imported from `Control.Monad.Trans.Resource' at Network/HTTP/Client/Conduit.hs:15:1-35
    (and originally defined in `Control.Monad.Trans.Resource.Internal')

These may be caused by --force-reinstalls. This is basically what cabal sandbox was created for so it may be easier to post a question about whatever is going wrong in updating that. You should be able to cabal install cabal-install to update it to the newest version.

Edit:

If cabal install cabal-install is working then the first thing I would check, as Chrules mentions, is where your path is pointed at. When you install cabal via cabal it will get put in ~/.cabal/bin so that needs to be first in your path. If you do which cabal you'l probably now see something like /usr/bin/cabal, you want that to be ~/.cabal/bin/cabal. Since you're local user packages are now messed up anway here's what I would do.

rm -rf ~/.cabal ~/.ghc # This deletes everything you installed with cabal
cabal update # Reinitialize the platform cabal
cabal install cabal-install # Update cabal
cabal install yesod # This will work since you nuked your ~/.cabal and ~/.ghc

After doing this you will have nothing installed but yesod, and you probably want yesod-bin as well since that has the yesod binary (at ~/.cabal/bin).