Browse thread
Re: Sexplib question
- berke.durak@gmail.com
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | berke.durak@gmail.com <berke.durak@g...> |
| Subject: | Re: Sexplib question |
On Mar 21, 8:31 pm, "a non" <anon2008...@gmail.com> wrote:
> Hi
>
> I have been following the threads about sexplib/deriving with interest and
> have a question
> about using sexplib with existing libraries.
>
> Example: If I want to use sexplib with values of type Netdate.t (a date type
> from the ocamlnet
> library) and try the following:
>
> type v = { name : string; created_at : Netdate.t} with sexp
>
> then I get the following error when compiling:
>
> Unbound value Netdate.t_of_sexp
>
> My question is, what is the easiest way to generate the sexp functions for
> Netdate.t, without modifying the code of the Netdate library ?
Just define a type alias for Netdate.t and define a printer for it, as
in :
type netdate = Netdate.t
let sexp_of_netdate n = Atom "foo"
let netdate_of_sexp = function Atom x -> ...
type v = { name : string; created_at : netdate} with sexp
--
Berke Durak