Search code examples
haskellhaskell-snap-framework

Snap Framework Compile error during fresh install


I'm receiving the following error when installing Snap for the first time. I've tried installing heist first but get the same error. I'm using Ubuntu 12.04 32bit desktop (brand new installation) and ghc 7.4.1.

Anyone else get this error? Solution? Thanks.

[18 of 29] Compiling Snap.Snaplet.HeistNoClass ( src/Snap/Snaplet/HeistNoClass.hs, dist/build/Snap/Snaplet/HeistNoClass.o )

src/Snap/Snaplet/HeistNoClass.hs:195:32:
Couldn't match expected type `n0 (Either e'0 b0)'
            with actual type `Text'
Expected type: String -> n0 (Either e'0 b0)
  Actual type: String -> Text
In the first argument of `(.)', namely `T.pack'
In the first argument of `mapEitherT', namely
  `(T.pack . intercalate "")'
cabal: Error: some packages failed to install:
sample1-0.1 depends on snap-0.10.0.1 which failed to install.
snap-0.10.0.1 failed during the building phase. The exception was:
ExitFailure 1
snaplet-sqlite-simple-0.4.0 depends on snap-0.10.0.1 which failed to install.

Solution

  • The dependecy of errors on either is specified as either >= 3.0.1, and either isn't listed as a build-dependency for snap (since the used module Control.Monad.Trans.Either is re-exported from Control.Error, that isn't necessary, even though snap directly uses code from either). Thus building snap pulls in the latest version of either.

    However, in either-3.1, the type of mapEitherT changed. It used to be

    mapEitherT :: Functor m => (e -> f) -> (a -> b) -> EitherT e m a -> EitherT f m b
    

    in either-3.0.*, and now it is

    mapEitherT :: (m (Either e a) -> n (Either e' b)) -> EitherT e m a -> EitherT e' n b
    

    The code was written for the old version.

    You can constrain the version of either to use,

    cabal install snaplet-sqlite-simple --constraint="either < 3.1"
    

    to build it.