caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Sexplib question
@ 2008-03-21 19:31 a non
  0 siblings, 0 replies; 2+ messages in thread
From: a non @ 2008-03-21 19:31 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 578 bytes --]

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 ?

Best regards
Anders

[-- Attachment #2: Type: text/html, Size: 672 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Sexplib question
       [not found] <fa.otHTYGw+NxPZCFRFIl96pONUliw@ifi.uio.no>
@ 2008-03-22 11:07 ` berke.durak
  0 siblings, 0 replies; 2+ messages in thread
From: berke.durak @ 2008-03-22 11:07 UTC (permalink / raw)
  To: a non; +Cc: caml-list

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-03-22 11:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-21 19:31 Sexplib question a non
     [not found] <fa.otHTYGw+NxPZCFRFIl96pONUliw@ifi.uio.no>
2008-03-22 11:07 ` berke.durak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).