caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "berke.durak@gmail.com" <berke.durak@gmail.com>
To: a non <anon2008123@gmail.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: Sexplib question
Date: Sat, 22 Mar 2008 04:07:43 -0700 (PDT)	[thread overview]
Message-ID: <20c787c8-b097-435c-99ef-28565f8b174a@z38g2000hsc.googlegroups.com> (raw)
In-Reply-To: <fa.otHTYGw+NxPZCFRFIl96pONUliw@ifi.uio.no>

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


       reply	other threads:[~2008-03-22 11:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <fa.otHTYGw+NxPZCFRFIl96pONUliw@ifi.uio.no>
2008-03-22 11:07 ` berke.durak [this message]
2008-03-21 19:31 a non

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20c787c8-b097-435c-99ef-28565f8b174a@z38g2000hsc.googlegroups.com \
    --to=berke.durak@gmail.com \
    --cc=anon2008123@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).