From 1c6ce98a2e27b2f3abf5ae5199d9357f592f7b44 Mon Sep 17 00:00:00 2001 From: sof Date: Mon, 10 May 1999 16:52:11 +0000 Subject: [PATCH] [project @ 1999-05-10 16:52:10 by sof] PrelHandle.withHandle: don't catch IO exceptions. --- ghc/lib/std/PrelException.lhs | 7 ++++++- ghc/lib/std/PrelHandle.lhs | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ghc/lib/std/PrelException.lhs b/ghc/lib/std/PrelException.lhs index 7f9b54f..1658c9d 100644 --- a/ghc/lib/std/PrelException.lhs +++ b/ghc/lib/std/PrelException.lhs @@ -1,5 +1,5 @@ % ----------------------------------------------------------------------------- -% $Id: PrelException.lhs,v 1.5 1999/03/17 13:19:20 simonm Exp $ +% $Id: PrelException.lhs,v 1.6 1999/05/10 16:52:10 sof Exp $ % % (c) The GRAP/AQUA Project, Glasgow University, 1998 % @@ -115,6 +115,11 @@ catch :: IO a -> (IOError -> IO a) -> IO a catch m k = catchException m handler where handler (IOException err) = k err handler other = throw other + +catchNonIO :: IO a -> (Exception -> IO a) -> IO a +catchNonIO m k = catchException m handler + where handler (IOException err) = ioError err + handler other = k other \end{code} Why is this stuff here? To avoid recursive module dependencies of diff --git a/ghc/lib/std/PrelHandle.lhs b/ghc/lib/std/PrelHandle.lhs index 1c63aea..079e144 100644 --- a/ghc/lib/std/PrelHandle.lhs +++ b/ghc/lib/std/PrelHandle.lhs @@ -85,7 +85,7 @@ newHandle hc = newMVar hc >>= \ h -> -- exception occur while performing said op. withHandle (Handle h) act = do h_ <- takeMVar h - v <- catchException (act h_) (\ ex -> putMVar h h_ >> throw ex) + v <- catchNonIO (act h_) (\ ex -> putMVar h h_ >> throw ex) return v writeHandle (Handle h) hc = putMVar h hc -- 1.7.10.4