-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does ppx_deriving_yojson support GADTs, or am I using it completely wrong? #87
Comments
I don't think ppx_deriving_yojson supports GADTs, but also I think your code should work. It seems to be a bug. |
Christ @whitequark, a minute and a quarter — that's gotta be some sort of new record 🤣. Okay! I think that's good news! Let me know if you need any help narrowing it down or reproducing it; my setup is really strange. Random maybe-relevant numbers:
(The rest are in the linked repository's opam-lockfile.) |
Unfortunately I haven't touched any of my OCaml code in... probably close to two years at this point. Been doing other things. |
Is there any update on this @whitequark? How did you proceed from here @ELLIOTTCABLE? |
No, there isn't any update on this. Why would you expect any? I no longer work on any of this code myself. |
To complement @whitequark answer: ideally we would indeed have support for some forms of GADTs (some subsets may be easier to handle than others, and some plugins may make this easier than others), but no one is working on this as far as I can tell. It's an interesting problem, so if there are any volunteers, please speak up :-) |
I am certainly interested in having GADTs work better with deriving; but can't promise any work in the short term. See also janestreet/ppx_sexp_conv#8 |
Also-see-also: ocaml-ppx/ppx_deriving#7. This is unfortunate; my particular use-case is that Menhir's inspection API generates a GADT. Generating converters for that would be nice!
Edit: Didn't even realize this was my own Issue when commenting. Oops! 🤣 |
Hi! I'm still pretty new to strictly typed languages in general, much less OCaml — maybe a year or so — so forgive me if this is suuuuuper obvious! Don't want to waste anybody's time!
So, I've got a pretty central type from my lexer that looks like this:
I'm consuming it in a file that I'm trying to use Yojson in; but I need a custom
located_to_yojson
function that basically discards the location-information:Unfortunately, this isn't working as expected — I'm getting this … rather, uh, unhelpful error:
Presumably, the
poly_a
is supposed to be a'a -> Yojson.Safe.json
-type function to convert the polymorphic argument of thenode
GADT-type into a Yojson type? But I tried to include that argument in my customlocated_to_yojson
function, and I'm still getting that error … what'm I doing wrong?The text was updated successfully, but these errors were encountered: