问题描述
尝试按如下方式安装scion-browser软件包时出现以下错误:
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?
谢谢。
推荐答案
问题是更改了使用的 StateT
类型。在 haskeline< 0.7
,它使用了Control.Monad.State 模块 rel = nofollow> mtl ,在版本0.7.0.0中, haskeline
删除了对 mtl
,并使用直接打包。但这本身就不是问题,因为 mtl
现在只是变形金刚
的包装。但是, haskeline
使用的模块是 Control.Monad.Trans.State.Strict
,而 mtl
中的> Control.Monad.State 包裹 Control.Monad.Trans.State.Lazy
。因此,
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'
来自 System.Console.Haskeline.MonadException
不再用于 StateT
由使用。
简单的解决方法是将 haskeline
限制为早期版本,
The easy fix is to constrain haskeline
to an earlier version,
cabal install --constraint="haskeline < 0.7" scion-browser
另一个解决方法是将 scion-browser
源中的导入更改为 Control.Monad.State.Strict
使其使用 haskeline-0.7.0.0
进行构建。
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
.
这篇关于安装Scion浏览器时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!