From dba80d765695b9b0fdb176e62cc92151ec49db83 Mon Sep 17 00:00:00 2001 From: John Millikin Date: Mon, 4 Apr 2011 21:28:30 -0700 Subject: [PATCH] stylistic --- Text/XML/LibXML/SAX.hs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Text/XML/LibXML/SAX.hs b/Text/XML/LibXML/SAX.hs index 29a41d8..d8244e9 100644 --- a/Text/XML/LibXML/SAX.hs +++ b/Text/XML/LibXML/SAX.hs @@ -51,7 +51,7 @@ module Text.XML.LibXML.SAX ) where import qualified Control.Exception as E -import Control.Monad (unless) +import Control.Monad (when, unless) import qualified Control.Monad.ST as ST import qualified Data.ByteString as B import qualified Data.ByteString.Unsafe as BU @@ -150,13 +150,11 @@ clearCallback p (Callback _ clear) = parserFromIO p (clear p) catchRef :: Parser m -> Ptr Context -> m Bool -> IO () catchRef p cb_ctx io = withParserIO p $ \ctx -> (cWantCallback ctx cb_ctx >>=) $ \want -> - if want == 1 - then do - continue <- E.catch (E.unblock (parserToIO p io)) $ \e -> do - writeIORef (parserErrorRef p) (Just e) - return False - unless continue (cStopParser ctx) - else return () + when (want == 1) $ do + continue <- E.catch (E.unblock (parserToIO p io)) $ \e -> do + writeIORef (parserErrorRef p) (Just e) + return False + unless continue (cStopParser ctx) catchRefIO :: Parser m -> Ptr Context -> IO Bool -> IO () catchRefIO p cb_ctx io = catchRef p cb_ctx (parserFromIO p io) -- 2.45.2