Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Pickling for OCaml?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jonathan Roewen <jonathan.roewen@g...>
Subject: Re: [Caml-list] Pickling for OCaml?
Oops, URLs are wrong =(

Files at http://devnulled.ath.cx/svn/dst/trunk/kernel/pickle.ml &
http://devnulled.ath.cx/svn/dst/trunk/kernel/pickle.mli

> Well, in the meantime, we've ported most of the pickling library from
> SML.NET to work with O'Caml. Supports most of the basic types
> (int,bool,char,string,list,array,unit,pairs->sextuples) and a few
> combinators (alttag, wrap, lift,seq).
>
> Fairly easy to define a pickler:
>
> module BytePickle = Pickle.CorePickle(Pickle.ByteCodec)
> open BytePickle
>
> let pickler = pair (string list,int)
>
> let data = pickle pickler (["hello";"world"],-1)
>
> let value = unpickle pickler (List.rev data)
>
> Files at http://devnulled.ath.cx/svn/dst/kernel/pickle.ml &
> http://devnulled.ath.cx/svn/dst/kernel/pickle.mli
>
> Kindest Regards,
>
> Jonathan
>