summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam T <pxqr.sta@gmail.com>2013-07-08 21:15:19 +0400
committerSam T <pxqr.sta@gmail.com>2013-07-08 21:15:19 +0400
commita437e18badb78bd4946ce4ecec830acdf000abee (patch)
tree84001c3ee85247386e3723dea34ef553636d9967
parent2be391c59deb670fd8084c6bd0fa9c2cbe2fd5cf (diff)
~ Fix GHC 7.6.3 warnings.
-rw-r--r--krpc.cabal2
-rw-r--r--src/Remote/KRPC/Protocol.hs10
2 files changed, 6 insertions, 6 deletions
diff --git a/krpc.cabal b/krpc.cabal
index 54746433..059f6348 100644
--- a/krpc.cabal
+++ b/krpc.cabal
@@ -8,6 +8,8 @@ copyright: (c) 2013, Sam T.
8category: Network 8category: Network
9build-type: Simple 9build-type: Simple
10cabal-version: >=1.8 10cabal-version: >=1.8
11tested-with: GHC == 7.4.1
12 , GHC == 7.6.3
11homepage: https://github.com/pxqr/krpc 13homepage: https://github.com/pxqr/krpc
12bug-reports: https://github.com/pxqr/krpc/issues 14bug-reports: https://github.com/pxqr/krpc/issues
13synopsis: KRPC remote procedure call protocol implementation. 15synopsis: KRPC remote procedure call protocol implementation.
diff --git a/src/Remote/KRPC/Protocol.hs b/src/Remote/KRPC/Protocol.hs
index 462f72eb..2e41bb2e 100644
--- a/src/Remote/KRPC/Protocol.hs
+++ b/src/Remote/KRPC/Protocol.hs
@@ -36,9 +36,8 @@ module Remote.KRPC.Protocol
36 , encode, encoded, decode, decoded, toBEncode, fromBEncode 36 , encode, encoded, decode, decoded, toBEncode, fromBEncode
37 ) where 37 ) where
38 38
39import Prelude hiding (catch)
40import Control.Applicative 39import Control.Applicative
41import Control.Exception.Lifted 40import Control.Exception.Lifted as Lifted
42import Control.Monad 41import Control.Monad
43import Control.Monad.IO.Class 42import Control.Monad.IO.Class
44import Control.Monad.Trans.Control 43import Control.Monad.Trans.Control
@@ -213,7 +212,6 @@ sendMessage :: BEncodable msg => msg -> KRemoteAddr -> KRemote -> IO ()
213sendMessage msg (host, port) sock = 212sendMessage msg (host, port) sock =
214 sendAllTo sock (LB.toStrict (encoded msg)) (SockAddrInet port host) 213 sendAllTo sock (LB.toStrict (encoded msg)) (SockAddrInet port host)
215{-# INLINE sendMessage #-} 214{-# INLINE sendMessage #-}
216{-# SPECIALIZE sendMessage :: BEncode -> KRemoteAddr -> KRemote -> IO () #-}
217 215
218recvResponse :: KRemote -> IO (Either KError KResponse) 216recvResponse :: KRemote -> IO (Either KError KResponse)
219recvResponse sock = do 217recvResponse sock = do
@@ -230,9 +228,9 @@ remoteServer :: (MonadBaseControl IO remote, MonadIO remote)
230 -> (KRemoteAddr -> KQuery -> remote (Either KError KResponse)) 228 -> (KRemoteAddr -> KQuery -> remote (Either KError KResponse))
231 -- ^ Handler. 229 -- ^ Handler.
232 -> remote () 230 -> remote ()
233remoteServer servport action = bracket (liftIO bind) (liftIO . sClose) loop 231remoteServer servport action = bracket (liftIO bindServ) (liftIO . sClose) loop
234 where 232 where
235 bind = do 233 bindServ = do
236 sock <- socket AF_INET Datagram defaultProtocol 234 sock <- socket AF_INET Datagram defaultProtocol
237 bindSocket sock (SockAddrInet servport iNADDR_ANY) 235 bindSocket sock (SockAddrInet servport iNADDR_ANY)
238 return sock 236 return sock
@@ -249,5 +247,5 @@ remoteServer servport action = bracket (liftIO bind) (liftIO . sClose) loop
249 where 247 where
250 handleMsg bs addr = case decoded bs of 248 handleMsg bs addr = case decoded bs of
251 Right query -> (either toBEncode toBEncode <$> action addr query) 249 Right query -> (either toBEncode toBEncode <$> action addr query)
252 `catch` (return . toBEncode . serverError) 250 `Lifted.catch` (return . toBEncode . serverError)
253 Left decodeE -> return $ toBEncode (ProtocolError (BC.pack decodeE)) 251 Left decodeE -> return $ toBEncode (ProtocolError (BC.pack decodeE))