Persistant (as in on disk) data

Simon Marlow
Mon, 10 Mar 2003 10:17:31 -0000

> > I'm not convinced that the binary library should "natively" support
> > cyclic data.  I think that if saying:
> >
> >   print x
> >
> > would not terminate, then there's no reason that
> >
> >   puts bh x
> >
> > should terminate.  I like to think of "puts" as a binary version of
> > print.  (That is, of course, unless the instance writer for the
> > Binary/Show instances of the type of x is smart enough to not keep
> > writing the same thing over and over again.)  I would challenge the
> > interested party to write a Show instance of String which=20
> wouldn't loop
> > indefinitely on "repeat 'x'".
> well, it is your choice to think of it as you like, but this=20
> is not what
> my original mail was about.  i think the ability to make data=20
> persistant
> is a useful one and it should be as transperant to the programmer as
> possible.  when i write something like:
> ones =3D 1 : ones
> i don't think of "printing infinately many ones in memory"=20
> and i don't see
> why i should start thinking of it that way just because i=20
> want to make the
> object persistant. after all, one can think of the disk as a verys low
> memory.

Ok, it seems that you're really after persistence as opposed to just
serialisation, which is what the Binary library provides.

I'm not aware of any working implementations of this kind of persistence
for current compilers, but it wouldn't be too much work to implement in
GHC, as long as you don't mind the persistent data being only readable
by particular binary that generated it, and refrain from any dynamic
linking of Haskell code.