安装scion-browser时出错

时间:2012-07-23 17:20:55

标签: haskell cabal

尝试按如下方式安装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

知道如何解决这个问题吗?

感谢。

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一起构建。