a universal printer for Haskell?

Bernard James POPE bjpop@cs.mu.OZ.AU
Tue, 19 Feb 2002 20:18:34 +1100 (EST)


Hi Christoph and all,

> > Bernie: talking about universal printer...

> yes, I'm such a Haskell programmer that would like such a mechanism but
> it only makes sense for me if you also have the inverse function.

For the simple scheme I presented the inverse is easy enough.

> In this case, you could save the state of your computation on disk and
> recover it later, send run-time functions to a remote machine 
> and execute them on that machine with full control by the programmer.
> This marshalling/unmarshalling mechanism is provided partially by
> some Haskell tools. 

Handling functions is always going to be hard. Actually, a related issue
in Haskell is what do you do with partially evaluated structures? 
Certainly in some circumstances you don't want to force the value just so
that you can write it out. If you compiled to byte code, life would be a lot
easier, however everything will get a lot messier if you want to mix
machine code and byte code. urgh...

I carefully avoided functions, because they require a lot more effort.

> Probably the reason that this mechanism doen't exist in Haskell yet is that
> it is difficult to implement. 

It is especially difficult if you want to make persistent data across
different implementations of the language. It would be nice if you
could write out some data to file from GHC and then read it in using NHC :)
There are obviously various degress of "persistence".

I think Clean has a prototype persistence mechanism, I saw a short demo
late last year. I'm not sure how they represent functional values. 
I think you can only read the data from within the same program that wrote
the data.

Cheers,
Bernie.