尝试安装 scion-browser 软件包时出现以下错误,如下所示:
% 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
,它使用了 Control.Monad.State
模块来自mtl ,在版本 0.7.0.0 中,haskeline
放弃了对 mtl
的依赖并使用 StateT
transformers 的 Monad 变压器直接打包。这本身不是问题,因为 mtl
现在只是 transformers
的包装。然而haskeline
使用的模块是 Control.Monad.Trans.State.Strict
,而Control.Monad.State
来自mtl
包裹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'
来自 System.Console.Haskeline.MonadException
不再适用于StateT
由 scion-browser 使用.
简单的解决方法是限制 haskeline
到早期版本,
cabal install --constraint="haskeline < 0.7" scion-browser
另一个修复是更改 scion-browser
中的导入来源Control.Monad.State.Strict
使其构建为 haskeline-0.7.0.0
.
关于haskell - 安装 scion 浏览器时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11617335/