我在尝试安装scion浏览器包时收到以下错误,如下所示:
% 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
知道怎么解决这个问题吗?
谢谢。
问题是haskeline-0.7.0.0更改了所使用的StateT
类型。在haskeline < 0.7
中,它使用了来自mtl的Control.Monad.State
模块,在0.7.0.0版本中,haskeline
放弃了对mtl
的依赖,直接使用transformers包的StateT
monad transformer。这本身就不是问题,因为mtl
现在只是transformers
的包装。然而,haskeline
使用的模块是Control.Monad.Trans.State.Strict
,而来自mtl
的Control.Monad.State
封装Control.Monad.Trans.State.Lazy
。因此
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'
来自CCD_ 14的CCD_。
简单的解决方案是将haskeline
约束到早期版本
cabal install --constraint="haskeline < 0.7" scion-browser
另一个修复方法是将scion-browser
源中的导入更改为Control.Monad.State.Strict
,使其使用haskeline-0.7.0.0
构建。