+{-# LANGUAGE CPP
+ , NoImplicitPrelude
+ , RecordWildCards
+ , BangPatterns
+ , PatternGuards
+ , NondecreasingIndentation
+ , MagicHash
+ , ForeignFunctionInterface
+ #-}
{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
{-# OPTIONS_HADDOCK hide #-}
-{-# LANGUAGE NoImplicitPrelude, RecordWildCards, BangPatterns #-}
-----------------------------------------------------------------------------
-- |
import Foreign
import Foreign.C
+import qualified Control.Exception as Exception
import Data.Typeable
import System.IO.Error
import Data.Maybe
maybeFillReadBuffer :: Handle__ -> CharBuffer -> IO (Maybe CharBuffer)
maybeFillReadBuffer handle_ buf
- = catch
+ = Exception.catch
(do buf' <- getSomeCharacters handle_ buf
return (Just buf')
)
- (\e -> do if isEOFError e
- then return Nothing
+ (\e -> do if isEOFError e
+ then return Nothing
else ioError e)
-- See GHC.IO.Buffer
lazyReadBuffered :: Handle -> Handle__ -> IO (Handle__, [Char])
lazyReadBuffered h handle_@Handle__{..} = do
buf <- readIORef haCharBuffer
- catch
- (do
+ Exception.catch
+ (do
buf'@Buffer{..} <- getSomeCharacters handle_ buf
lazy_rest <- lazyRead h
(s,r) <- if haInputNL == CRLF
-- that bufReadNBNonEmpty will not
-- issue another read.
else
- bufReadNBEmpty h_ buf (castPtr ptr) 0 count
+ bufReadNBNonEmpty h_ buf (castPtr ptr) 0 count
haFD :: Handle__ -> FD
haFD h_@Handle__{..} =