Browse files

Use the right versions of catch and throw.

  • Loading branch information...
1 parent a298240 commit 419ee9be61a89cc45f77831a1e4115f47f20f7dd @bos committed Jun 10, 2011
Showing with 6 additions and 4 deletions.
  1. +2 −0 Data/Text/IO/Internal.hs
  2. +4 −4 Data/Text/Lazy/IO.hs
@@ -19,6 +19,7 @@ module Data.Text.IO.Internal
) where
#if __GLASGOW_HASKELL__ >= 612
+import Control.Exception (catch)
import Data.IORef (readIORef, writeIORef)
import Data.Text (Text)
import Data.Text.Fusion (unstream)
@@ -31,6 +32,7 @@ import GHC.IO.Buffer (Buffer(..), CharBuffer, RawCharBuffer, bufferAdjustL,
withRawBuffer, writeCharBuf)
import GHC.IO.Handle.Internals (ioe_EOF, readTextDevice, wantReadableHandle_)
import GHC.IO.Handle.Types (Handle__(..), Newline(..))
+import Prelude hiding (catch)
import System.IO (Handle)
import System.IO.Error (isEOFError)
import qualified Data.Text as T
@@ -38,8 +38,8 @@ module Data.Text.Lazy.IO
) where
import Data.Text.Lazy (Text)
-import Prelude hiding (appendFile, getContents, getLine, interact, putStr,
- putStrLn, readFile, writeFile)
+import Prelude hiding (appendFile, catch, getContents, getLine, interact,
+ putStr, putStrLn, readFile, writeFile)
import System.IO (Handle, IOMode(..), hPutChar, openFile, stdin, stdout,
import qualified Data.Text.IO as T
@@ -49,7 +49,7 @@ import Data.Text.Lazy.Encoding (decodeUtf8)
import qualified Data.ByteString.Char8 as S8
import qualified Data.ByteString.Lazy.Char8 as L8
-import Control.Exception (throw)
+import Control.Exception (catch, throwIO)
import Control.Monad (when)
import Data.IORef (readIORef)
import Data.Text.IO.Internal (hGetLineWith, readChunk)
@@ -134,7 +134,7 @@ lazyReadBuffered h hh@Handle__{..} = do
then return $ if isEmptyBuffer buf
then (hh', empty)
else (hh', L.singleton '\r')
- else throw (augmentIOError e "hGetContents" h)
+ else throwIO (augmentIOError e "hGetContents" h)
-- | Read a single line from a handle.

0 comments on commit 419ee9b

Please sign in to comment.