问题
I get the following error when trying to install the scion-browser package as follows:
% cabal install scion-browser-0.2.9
<snipped>
[23 of 23] Compiling Main ( src/Main.hs, dist/build/scion-browser/scion-browser-tmp/Main.o )
src/Main.hs:31:24:
No instance for (MonadException BrowserM)
arising from a use of `getInputLine'
Possible fix:
add an instance declaration for (MonadException BrowserM)
In a stmt of a 'do' block: maybeLine <- getInputLine ""
In the expression:
do { maybeLine <- getInputLine "";
case maybeLine of {
Nothing -> return ()
Just line -> do { ... } } }
In an equation for `loop':
loop
= do { maybeLine <- getInputLine "";
case maybeLine of {
Nothing -> return ()
Just line -> ... } }
cabal: Error: some packages failed to install:
scion-browser-0.2.9 failed during the building phase. The exception was:
ExitFailure 1
Any idea how to fix this?
Thanks.
回答1:
The problem is that haskeline-0.7.0.0 changed the used StateT
type. In haskeline < 0.7
, it used the Control.Monad.State
module from mtl, in version 0.7.0.0, haskeline
dropped the dependency on mtl
and uses the StateT
monad transformer of the transformers package directly. That would in itself not be a problem, since mtl
now is just a wrapper around transformers
. However, the module used by haskeline
is Control.Monad.Trans.State.Strict
, while Control.Monad.State
from mtl
wraps Control.Monad.Trans.State.Lazy
. Thus the
instance MonadException m => MonadException (StateT s m) where
controlIO f = StateT $ \s -> controlIO $ \(RunIO run) -> let
run' = RunIO (fmap (StateT . const) . run . flip runStateT s)
in fmap (flip runStateT s) $ f run'
from System.Console.Haskeline.MonadException
is no longer for the StateT
used by scion-browser.
The easy fix is to constrain haskeline
to an earlier version,
cabal install --constraint="haskeline < 0.7" scion-browser
The other fix would be changing the imports in the scion-browser
source to Control.Monad.State.Strict
to make it build with haskeline-0.7.0.0
.
来源:https://stackoverflow.com/questions/11617335/error-installing-scion-browser