caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Dario Teixeira <darioteixeira@yahoo.com>
To: caml-list@yquem.inria.fr
Subject: Sexplib and types defined via constraint
Date: Fri, 25 Jul 2008 05:31:09 -0700 (PDT)	[thread overview]
Message-ID: <363597.53244.qm@web54607.mail.re2.yahoo.com> (raw)

Hi,

I've been using Sexplib quite extensively.  The syntax extension makes adding
(de)serialisation functions very simple and convenient, and up till now it
has automatically handled every data structure I threw at it.

But consider the module fragment below; type t is defined via a constraint,
and includes a type parameter ('b) used as a phantom type.  The Sexplib syntax
extension fails to parse the definition of t, producing an error:

Failure: "get_tparam_id: not a type parameter"
Preprocessing error on file document.ml

Is this a known limitation of Sexplib, in which case the (de)serialization
functions for t must be built manually?

Thanks in advance,
Dario Teixeira


module rec Foobar:
sig
        type foo_t = [ `A of int | `B of Foobar.bar_t ] with sexp
        type bar_t = [ `C of int | `D of Foobar.foo_t ] with sexp
        type foobar_t = [ foo_t | bar_t ] with sexp

        type (+'a, 'b) t = private Foobar of 'a constraint 'a = [< foobar_t ] with sexp
end =
struct
        type foo_t = [ `A of int | `B of Foobar.bar_t ] with sexp
        type bar_t = [ `C of int | `D of Foobar.foo_t ] with sexp
        type foobar_t = [ foo_t | bar_t ] with sexp

        type (+'a, 'b) t = Foobar of 'a constraint 'a = [< foobar_t ] with sexp
end



      __________________________________________________________
Not happy with your email address?.
Get the one you really want - millions of new email addresses available now at Yahoo! http://uk.docs.yahoo.com/ymail/new.html


             reply	other threads:[~2008-07-25 12:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-25 12:31 Dario Teixeira [this message]
2008-07-25 20:04 ` [Caml-list] " Markus Mottl
2008-07-25 21:43   ` Stefano Zacchiroli
2008-07-25 22:36     ` Markus Mottl

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=363597.53244.qm@web54607.mail.re2.yahoo.com \
    --to=darioteixeira@yahoo.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).