Question

Using cabal, I tried to install acid-state on Haskell Platform 2012.2.0.0 (Windows XP) but got the following error:

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
Was it helpful?

Solution

This sort of trouble frequently arises when going over to the extensible exceptions system. tryE and catchIO are standard boilerplate; they just specialize catch and try to use SomeException and IOException

 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

So do cabal unpack acid-state, and replace src-win32/FileIO.hs with this, which defines them on lines 18ff https://gist.github.com/4032603 And then do cabal install from the outer directory, the one with the acid-state.cabal file.

There's probably some additional mistake, since I cant test it at the moment. As Paul R. says, when you get it to compile, send it to the maintainers. The package is heavily maintained, but it looks like they are in need of a Windows tester. Acid-state is certainly worth the trouble. You should also try some of the modules in the examples/ directory, which make an excellent tutorial in any case. If you have more troubles write back, we can devise a suitable patched file together.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top