import Char ( chr )
-- urk!
-#include "../lib/std/cbits/error.h"
+#include "../lib/std/cbits/stgerror.h"
#if __GLASGOW_HASKELL__ >= 303
import IO ( openFile, slurpFile )
#endif
#if __GLASGOW_HASKELL__ < 301
-import IOBase ( IOError(..), IOErrorType(..) )
+import IOBase ( Handle, IOError(..), IOErrorType(..),
+ constructErrorAndFail )
import IOHandle ( readHandle, writeHandle, filePtr )
import PackBase ( unpackCStringBA )
#else
trySlurp :: Handle -> Int -> Addr -> IO (Addr, Int)
trySlurp handle sz_i chunk =
-#if __GLASGOW_HASKELL__ >= 303
+#if __GLASGOW_HASKELL__ == 303
+ wantReadableHandle "hGetChar" handle >>= \ handle_ ->
+ let fo = haFO__ handle_ in
+#elif __GLASGOW_HASKELL__ > 303
wantReadableHandle "hGetChar" handle $ \ handle_ ->
let fo = haFO__ handle_ in
#else
reAllocMem ptr sz = do
chunk <- _ccall_ realloc ptr sz
if chunk == nullAddr
-#if __GLASGOW_HASKELL__ < 303
- then fail (userError "reAllocMem")
-#else
+#if __GLASGOW_HASKELL__ >= 400
then fail "reAllocMem"
+#else
+ then fail (userError "reAllocMem")
#endif
else return chunk