尝试按如下方式安装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
知道如何解决这个问题吗?
感谢。
答案 0 :(得分:4)
问题是haskeline-0.7.0.0更改了使用的StateT
类型。在haskeline < 0.7
中,它使用mtl中的Control.Monad.State
模块,在版本0.7.0.0中,haskeline
删除了对mtl
的依赖关系并使用了StateT
直接transformers包的monad变换器。这本身不是问题,因为mtl
现在只是transformers
的包装。但是,haskeline
使用的模块为Control.Monad.Trans.State.Strict
,而来自Control.Monad.State
的{{1}}包含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'
的不再适用于scion-browser使用的System.Console.Haskeline.MonadException
。
简单的解决方法是将StateT
约束到早期版本
haskeline
另一个解决方法是将cabal install --constraint="haskeline < 0.7" scion-browser
来源中的导入更改为scion-browser
,以使其与Control.Monad.State.Strict
一起构建。