1

使用 cabal,我尝试在 Haskell Platform 2012.2.0.0 (Windows XP) 上安装 acid-state,但出现以下错误:

src-win32\FileIO.hs:43:5:
    Not in scope: catchIO Perhaps you meant `catch' (imported from Prelude)

src-win32\FileIO.hs:55:6:
    Not in scope: tryE Perhaps you meant `try' (imported from Control.Exception.Extensible)

src-win32\FileIO.hs:56:6:
    Not in scope: tryE
    Perhaps you meant `try' (imported from Control.Exception.Extensible)
cabal: Error: some packages failed to install:
acid-state-0.8.1 failed during the building phase. The exception was:
ExitFailure 1
4

1 回答 1

1

当转到可扩展异常系统时,经常会出现这种问题。tryE并且catchIO是标准样板;他们只是专注于使用catchtrySomeExceptionIOException

 import Control.Exception.Extensible(try,throw)
 import Control.Exception(SomeException,IOException)
 import qualified Control.Exception as E 
 tryE :: IO a -> IO (Either SomeException a)
 tryE = try
 catchIO :: IO a -> (IOException -> IO a) -> IO a
 catchIO = E.catch

这样做cabal unpack acid-state,并将 src-win32/FileIO.hs 替换为this ,它在第 18 行https://gist.github.com/4032603上定义它们 然后cabal install从外部目录执行,即acid-state.cabal文件所在的目录。

可能还有一些额外的错误,因为我目前无法测试它。正如 Paul R. 所说,当你编译它时,将它发送给维护者。该软件包得到大量维护,但看起来他们需要 Windows 测试仪。酸状态当然值得麻烦。您还应该尝试 examples/ 目录中的一些模块,这无论如何都是一个很好的教程。如果回写比较麻烦,我们可以一起设计一个合适的补丁文件。

于 2012-11-07T16:37:12.290 回答