msgpack-rpc 0.3.1.3 → 0.4.0
raw patch · 5 files changed
+39/−7 lines, 5 filesdep ~msgpackPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: msgpack
API changes (from Hackage documentation)
Files
- msgpack-rpc.cabal +8/−4
- src/Network/MessagePackRpc/Client.hs +2/−2
- src/Network/MessagePackRpc/Server.hs +1/−1
- test/Cli.hs +17/−0
- test/Serv.hs +11/−0
msgpack-rpc.cabal view
@@ -1,5 +1,5 @@ Name: msgpack-rpc-Version: 0.3.1.3+Version: 0.4.0 Synopsis: A MessagePack-RPC Implementation Description: A MessagePack-RPC Implementation <http://msgpack.org/>@@ -11,20 +11,24 @@ Author: Hideyuki Tanaka Maintainer: Hideyuki Tanaka <tanaka.hideyuki@gmail.com> Homepage: http://github.com/msgpack/msgpack-rpc-Stability: Experimental+Stability: Experimental Cabal-version: >=1.6 Build-type: Simple +Extra-source-files:+ test/Serv.hs+ test/Cli.hs+ Library Build-depends: base >= 4 && <5,- msgpack >= 0.3.1 && < 0.4,+ msgpack >= 0.4.0 && < 0.5, network >= 2.2.1.7 && < 2.2.2, random >= 1.0.0.2 && < 1.1, transformers >= 0.2.1 && < 0.2.2, iteratee >= 0.4.0.2 && < 0.4.1, deepseq >= 1.1 && < 1.2 - Ghc-options: -Wall+ Ghc-options: -Wall Hs-source-dirs: src Exposed-modules:
src/Network/MessagePackRpc/Client.hs view
@@ -92,7 +92,7 @@ fromObject' :: OBJECT o => Object -> o fromObject' o =- case fromObject o of+ case tryFromObject o of Left err -> throw $ ResultTypeError err Right r -> r @@ -112,7 +112,7 @@ throw $ ProtocolError $ "response type is not 1 (got " ++ show rtype ++ ")" when (rmsgid /= msgid) $ throw $ ProtocolError $ "message id mismatch: expect " ++ show msgid ++ ", but got " ++ show rmsgid- case fromObject rerror of+ case tryFromObject rerror of Left _ -> throw $ ServerError rerror Right () ->
src/Network/MessagePackRpc/Server.hs view
@@ -60,7 +60,7 @@ fromObject' :: OBJECT o => Object -> o fromObject' o =- case fromObject o of+ case tryFromObject o of Left err -> error $ "argument type error: " ++ err Right r -> r
+ test/Cli.hs view
@@ -0,0 +1,17 @@+import Network.MessagePackRpc.Client++import Control.Concurrent+import Control.Monad++add :: RpcMethod (Int -> Int -> IO Int)+add = method "add"++echo :: RpcMethod (String -> IO String)+echo = method "echo"++main :: IO ()+main = do+ conn <- connect "127.0.0.1" 8081+ forM_ [0..10000] $ \i -> do+ print =<< add conn i (i*2)+ print =<< add conn (i*2) (i*3)
+ test/Serv.hs view
@@ -0,0 +1,11 @@+import Network.MessagePackRpc.Server++add :: Int -> Int -> IO Int+add x y = return $ x+y++echo :: String -> IO String+echo s = return s++main :: IO ()+main = do+ serve 8081 [ ("add", fun add), ("echo", fun echo) ]