janestreet / sexplib

Automated S-expression conversion
MIT License
147 stars 27 forks source link

pa_sexp_conv and GADTs #1

Closed trefis closed 11 years ago

trefis commented 11 years ago

I installed Core (and sexplib) with opam a few days ago, and I am currently using the version 108.08 of sexplib, but pa_sexp_conv doesn't seem to have changed since 108.07 so the problem I have should still be present in the latest version.

The problem is the following : # type foo = Foo : foo with sexp;; Error: Failure: "branch_sum: unknown type\nFoo : foo"

I don't know camlp4 at all, but from what I've seen I would guess that the error is raised at the line 387 of pa_sexp_conv.ml. I don't know whether GADTs are not handled because they might make it impossible (in some cases involving existential types) to generate the usual functions (I haven't thought about it much), but even so they should be matched and a specific error should be raised.

And if they don't cause any problem then handling them would be great (ofc).

ghost commented 11 years ago

There is indeed an issue in the presence of existential types. I'll see what we can do about error messages.

ghost commented 11 years ago

Error messages have been updated.

jordwalke commented 10 years ago

So what's the progress on existential types?

ghost commented 10 years ago

With recent version of sexplib sexp_of_t produces Sexp.Atom "_" for existential types and t_of_sexp fails.

jordwalke commented 10 years ago

Well that makes sense! Thank you. This is a fantastic library.