-- 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.8.0 -- | 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 :: Int -> Int -> Client Int -- add = call "add" -- -- main = runClient "localhost" 5000 $ do -- ret <- add 123 456 -- liftIO $ print ret --module Network.MessagePackRpc.Client data ClientT m a type Client = ClientT IO runClient :: (MonadIO m, MonadBaseControl IO m) => String -> Int -> ClientT m a -> m () -- | Call an RPC Method call :: RpcType a => String -> a -- | RPC error type data RpcError -- | Server error ServerError :: Object -> RpcError -- | Result type mismatch ResultTypeError :: String -> RpcError -- | Protocol error ProtocolError :: String -> RpcError instance Typeable RpcError instance Monad m => Monad (ClientT m) instance MonadIO m => MonadIO (ClientT m) instance MonadThrow m => MonadThrow (ClientT m) instance Show RpcError instance Eq RpcError instance Ord RpcError instance (OBJECT o, RpcType r) => RpcType (o -> r) instance (MonadIO m, MonadThrow m, OBJECT o) => RpcType (ClientT m o) instance Exception RpcError instance MonadTrans ClientT -- | 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 -> Method Int
-- add x y = return $ x + y
--
-- main = serve 1234 [("add", toMethod add)]
--
module Network.MessagePackRpc.Server
type RpcMethod m = [Object] -> m Object
class MethodType f m | f -> m
toMethod :: MethodType f m => f -> RpcMethod m
newtype MethodT m a
MethodT :: m a -> MethodT m a
unMethodT :: MethodT m a -> m a
type Method = MethodT IO
-- | Start RPC server with a set of RPC methods.
serve :: (MonadIO m, MonadThrow m, MonadBaseControl IO m) => Int -> [(String, RpcMethod m)] -> m ()
instance Typeable ServerError
instance Show ServerError
instance Functor m => Functor (MethodT m)
instance Applicative m => Applicative (MethodT m)
instance Monad m => Monad (MethodT m)
instance MonadIO m => MonadIO (MethodT m)
instance (OBJECT o, MethodType r m) => MethodType (o -> r) m
instance (MonadThrow m, MonadBaseControl IO m, OBJECT o) => MethodType (MethodT m o) m
instance MonadTrans MethodT
instance Exception ServerError