2

尝试安装 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

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

谢谢。

4

1 回答 1

4

问题是haskeline-0.7.0.0改变了使用的StateT类型。在haskeline < 0.7中,它使用了Control.Monad.State来自mtl的模块,在 0.7.0.0 版本中,删除了对并直接使用了transformers包的monad 转换器haskeline的依赖。这本身不是问题,因为now 只是. 但是,使用的模块is ,而from wraps 。就这样mtlStateTmtltransformershaskelineControl.Monad.Trans.State.StrictControl.Monad.StatemtlControl.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'

fromSystem.Console.Haskeline.MonadException不再用于StateTscion -browser

简单的解决方法是限制haskeline到早期版本,

cabal install --constraint="haskeline < 0.7" scion-browser

另一个修复方法是将scion-browser源中的导入更改为Control.Monad.State.Strict使用haskeline-0.7.0.0.

于 2012-07-23T19:08:38.210 回答