-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A MessagePack-RPC Implementation -- -- A MessagePack-RPC Implementation http://msgpack.org/ @package msgpack-rpc @version 0.3.1.3 -- | This module is client library of MessagePack-RPC. The specification of -- MessagePack-RPC is at -- http://redmine.msgpack.org/projects/msgpack/wiki/RPCProtocolSpec. -- -- A simple example: -- --
-- import Network.MessagePackRpc.Client -- -- add :: RpcMethod (Int -> Int -> IO Int) -- add = method "add" -- -- main = do -- conn <- connect "127.0.0.1" 1234 -- print =<< add conn 123 456 --module Network.MessagePackRpc.Client -- | RPC connection type data Connection -- | Connect to RPC server connect :: String -> Int -> IO Connection -- | Disconnect a connection disconnect :: Connection -> IO () -- | RPC error type data RpcError -- | Server error ServerError :: Object -> RpcError -- | Result type mismatch ResultTypeError :: String -> RpcError -- | Protocol error ProtocolError :: String -> RpcError type RpcMethod a = Connection -> a -- | Call an RPC Method call :: (RpcType a) => Connection -> String -> a -- | Create an RPC Method (call c m == method m c) method :: (RpcType a) => String -> RpcMethod a instance Typeable RpcError instance Eq RpcError instance Ord RpcError instance (OBJECT o, RpcType r) => RpcType (o -> r) instance (OBJECT o) => RpcType (IO o) instance Show RpcError instance Exception RpcError -- | This module is server library of MessagePack-RPC. The specification of -- MessagePack-RPC is at -- http://redmine.msgpack.org/projects/msgpack/wiki/RPCProtocolSpec. -- -- A simple example: -- --
-- import Network.MessagePackRpc.Server
--
-- add :: Int -> Int -> IO Int
-- add x y = return $ x + y
--
-- main =
-- serve 1234 [("add", fun add)]
--
module Network.MessagePackRpc.Server
type RpcMethod = [Object] -> IO Object
class RpcMethodType f
toRpcMethod :: (RpcMethodType f) => f -> RpcMethod
-- | Create a RPC method from a Haskell function.
fun :: (RpcMethodType f) => f -> RpcMethod
-- | Start RPC server with a set of RPC methods.
serve :: Int -> [(String, RpcMethod)] -> IO ()
instance (OBJECT o, RpcMethodType r) => RpcMethodType (o -> r)
instance (OBJECT o) => RpcMethodType (IO o)