[Haskell-cafe] Haskell RPC
Jason Dagit
dagit at eecs.oregonstate.edu
Thu May 25 14:25:31 EDT 2006
On 5/25/06, Joel Reymont <joelr1 at gmail.com> wrote:
> This is an example from my test harness:
>
> (define-test remote-basic
> (def-remote-class remote (server) ())
> (def-remote-method sum :sync ((self remote) (a fixnum) (b integer))
> (declare (ignorable ip port))
> (+ a b seqnum))
> (let* ((port (+ 1000 (random 50000)))
> (server (make-instance 'remote
> :port port))
> (client (make-instance 'remote-proxy
> :host (host-address)
> :port port)))
> (assert-equal '(6) (sum client 1 2 :seqnum 3))
> (stop server)
> (stop client)
> ))
>
I won't comment on the difference between haskell and lisp (both
languages I respect), but I will say that you should add a macro or
high order function (depneding on lisp vs. haskell) that is something
like "(with-client (c args-list) body)", that way you can simplify
the creation/cleanup of clients. Same idea as with-open-file. You can
do the same with server.
As for your actual question, there is a deriving(Read), but I don't
remember what extensions are needed.
Jason
More information about the Haskell-Cafe
mailing list