   status <- readMVar statusFromServer
   return (RpcOk status)
 
-clientClose :: ClientReaderWriter -> IO ()
-clientClose (ClientReaderWriter{..}) = do
-  withMVar callMVar_ $ \call ->
-    grpcCallDestroy call
-
 clientWrite :: ClientReaderWriter -> B.ByteString -> IO (RpcReply ())
 clientWrite crw@(ClientReaderWriter{..}) arg = do
   sendMessageOp <- opSendMessage arg


sendMessage :: req -> Rpc req resp ()
sendMessage req = do
  abortIfStatus
  encoder <- askEncoder
  bs <- joinReply =<< liftIO (encoder req)
  joinClientRWOp (\crw -> clientWrite crw bs)

sendHalfClose :: Rpc req resp ()
sendHalfClose = do
  abortIfStatus
  joinClientRWOp clientSendHalfClose

closeCall :: Rpc req resp ()
closeCall =
  clientRWOp clientClose

data RpcReply a
  = RpcOk a

      | code == StatusOk -> onSuccess
      | otherwise -> onFail code msg

throwIfErrorStatus :: Rpc req resp ()
throwIfErrorStatus =
  branchOnStatus
    (return ())
    (return ())
