Sending wide characters over the network socket

Andrew J Bromage ajb@spamcop.net
Mon, 7 Jul 2003 09:57:47 +1000


G'day all.

On Sat, Jul 05, 2003 at 11:44:54PM -0400, Dimitry Golubovsky wrote:

> What would be really nice to have is some sort of object input/output 
> over network. Then, by sending a String, I would expect it to be 
> recreated at the other end. And if the other end expects, say [Int] then 
> an error would be detected.

Well there is already a binding for COM (which isn't portable, of
course), a beta binding for CORBA, several XML libaries and a
half-finished binding for ASN.1.  Any of these would get you at
least part of the way there.

I think what you are asking for, though, is some equivalent of Java's
serializable objects.  I'm not convinced that producing yet another
RPC protocol would be a useful thing, even if it was optimised for
Haskell.  It seems to me that adequately supporting the large number
of existing standards (off the top of my head: DCOM, CORBA, XML-RPC,
SOAP, .NET, ASN.1 and Sun RPC; no doubt I've missed a few) would be a
far better use of effort.

One thing which would be good was a more extensible "derives" keyword
which lets you automatically derive code to marshall and demarshall
for whatever RPC protocol you want.  I'd love to be able to write:

	data SomeComplexType
	  = Stuff MoreStuff EvenMoreStuff
	  | AndSomeMore AdNauseam
		deriving( Asn1.Ber, Asn1.Xer, XmlRpc, DCom )

and have it automatically generate any interface definitions (IDL,
ASN.1 specifications, whatever) suitable to hold the data type.

> I haven't looked through the whole GHC 
> runtime, and maybe something like this is already there, any clue is 
> welcome.

The only built-in thing is Read/Show, which is functional, but slow,
as its representation is textual.

Cheers,
Andrew Bromage