           Nothing -> return (reverse acc)
   go []
 
-sendMessage :: o -> Rpc o i ()
+sendMessage :: req -> Rpc req resp ()
 sendMessage o = do
   crw <- askCrw
   encoder <- askEncoder
   x <- joinReply =<< liftIO (encoder o)
   joinReply =<< liftIO (clientWrite crw x)
 
-sendClose :: Rpc o i ()
+sendClose :: Rpc req resp ()
 sendClose = do
   crw <- askCrw
   joinReply =<< liftIO (clientSendClose crw)
 
-closeCall :: Rpc o i ()
+closeCall :: Rpc req resp ()
 closeCall = do
   crw <- askCrw
   liftIO (clientClose crw)

      decoder <- askDecoder
      liftM Just (joinReply =<< liftIO (decoder x))

receiveAllMessages :: Rpc o i [i]
receiveAllMessages = do
  crw <- askCrw
  decoder <- askDecoder

            _ -> return (RpcError (StatusError status statusDetails))
        RpcError err -> return (RpcError err)

data Client req resp = Client
  { clientCrw :: ClientReaderWriter
  , clientEncoder :: Encoder req
  , clientDecoder :: Decoder resp
  }

type Decoder a = L.ByteString -> IO (RpcReply a)
type Encoder a = a -> IO (RpcReply B.ByteString)
