generalize RPC mechanism on Haskell side, add RPC call