From e40f5e26b06477aa2f4378102c64700a185210e7 Mon Sep 17 00:00:00 2001 From: John Millikin Date: Sun, 6 Feb 2011 21:39:07 -0800 Subject: [PATCH] Remove -fno-warn-unused-do-bind from GHC options, and fix resulting warnings. --- Network/Protocol/XMPP/Client.hs | 11 +++++++---- Network/Protocol/XMPP/Handle.hs | 6 ++---- network-protocol-xmpp.cabal | 6 +----- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/Network/Protocol/XMPP/Client.hs b/Network/Protocol/XMPP/Client.hs index b605d22..5c5734d 100644 --- a/Network/Protocol/XMPP/Client.hs +++ b/Network/Protocol/XMPP/Client.hs @@ -60,7 +60,7 @@ runClient server jid username password xmpp = do newStream :: J.JID -> M.XMPP [F.Feature] newStream jid = do M.putBytes $ C.xmlHeader "jabber:client" jid - M.readEvents C.startOfStream + void (M.readEvents C.startOfStream) F.parseFeatures `fmap` M.getElement tryTLS :: J.JID -> [F.Feature] -> ([F.Feature] -> M.XMPP a) -> M.XMPP a @@ -68,7 +68,7 @@ tryTLS sjid features m | not (streamSupportsTLS features) = m features | otherwise = do M.putElement xmlStartTLS - M.getElement + void M.getElement h <- M.getHandle eitherTLS <- liftIO $ runErrorT $ H.startTLS h case eitherTLS of @@ -115,10 +115,10 @@ bindJID jid = do -- Session M.putStanza sessionStanza - M.getStanza + void M.getStanza M.putStanza $ emptyPresence PresenceAvailable - M.getStanza + void M.getStanza return returnedJID @@ -141,3 +141,6 @@ streamSupportsTLS = any isStartTLS where xmlStartTLS :: X.Element xmlStartTLS = X.nselement "urn:ietf:params:xml:ns:xmpp-tls" "starttls" [] [] + +void :: Monad m => m a -> m () +void m = m >> return () diff --git a/Network/Protocol/XMPP/Handle.hs b/Network/Protocol/XMPP/Handle.hs index de28f37..5587052 100644 --- a/Network/Protocol/XMPP/Handle.hs +++ b/Network/Protocol/XMPP/Handle.hs @@ -60,8 +60,6 @@ hGetBytes :: Handle -> Integer -> ErrorT T.Text IO B.ByteString hGetBytes (PlainHandle h) n = liftIO $ B.hGet h $ fromInteger n hGetBytes (SecureHandle h s) n = liftTLS s $ do pending <- TLS.checkPending - when (pending == 0) $ do - liftIO $ IO.hWaitForInput h (- 1) - return () - + let wait = IO.hWaitForInput h (- 1) >> return () + when (pending == 0) (liftIO wait) TLS.getBytes n diff --git a/network-protocol-xmpp.cabal b/network-protocol-xmpp.cabal index 8255f0f..5df5b73 100644 --- a/network-protocol-xmpp.cabal +++ b/network-protocol-xmpp.cabal @@ -19,11 +19,7 @@ source-repository head location: http://john-millikin.com/software/network-protocol-xmpp/ library - if true - ghc-options: -Wall - - if impl(ghc >= 6.11) - ghc-options: -fno-warn-unused-do-bind + ghc-options: -Wall build-depends: base >= 3 && < 5 -- 2.45.2