caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Sexplib and types defined via constraint
@ 2008-07-25 12:31 Dario Teixeira
  2008-07-25 20:04 ` [Caml-list] " Markus Mottl
  0 siblings, 1 reply; 4+ messages in thread
From: Dario Teixeira @ 2008-07-25 12:31 UTC (permalink / raw)
  To: caml-list

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


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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-25 12:31 Sexplib and types defined via constraint Dario Teixeira
2008-07-25 20:04 ` [Caml-list] " Markus Mottl
2008-07-25 21:43   ` Stefano Zacchiroli
2008-07-25 22:36     ` Markus Mottl

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).