Skip to content
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

Error: Unbound module Fields #1

Closed
agarwal opened this issue Nov 6, 2015 · 5 comments
Closed

Error: Unbound module Fields #1

agarwal opened this issue Nov 6, 2015 · 5 comments

Comments

@agarwal
Copy link

agarwal commented Nov 6, 2015

$ cat foo.ml
type t = {a:int; b:string} [@@deriving xml]

$ ocamlfind ocamlc -package ppx_xml_conv -c foo.ml
findlib: [WARNING] Interface main.cmi occurs in several directories: ., ~/.opam/4.02.3/lib/ocaml/compiler-libs
File "foo.ml", line 1, characters 0-43:
Error: Unbound module Fields

I checked Fieldslib and it only has Field, not Fields. Many of the ppx_*_conv packages seem to be missing ocamlfind dependencies, e.g. see also janestreet/ppx_sexp_conv#1.

@ghost
Copy link

ghost commented Nov 6, 2015

The Fields module comes from [@@deriving fields], from ppx_fields_conv. However I think ppx_xml_conv suffers from the same problem as ppx_csv_conv: janestreet/ppx_csv_conv#1, i.e. the runtime lib for ppx_xml_conv is missing. Sorry for that, we are currently reworking our public release process which will make it easier for us to provide fixes quicker.

@agarwal
Copy link
Author

agarwal commented Nov 7, 2015

Got it. Thanks.

Just in case anyone else gets to this issue, note there's no manual workaround for now because this lib also ends up depending on the unreleased csvfields mentioned in the other issue.

@vbmithr
Copy link

vbmithr commented Feb 15, 2017

Not working with the ppx-driver method. I think there is 2 issues:

  • Impossible to generate the Fields module before the XML code, no matter how I try, I always end up with having the XML code generated before the Fields module.

  • When the type has a name, the generated module is Fields_of_name, whereas the generated XML code requires module Fields

@vbmithr
Copy link

vbmithr commented Feb 15, 2017

Ok, actually

type t = {
  a : string ;
} [@@deriving xml,fields]

works, but fails if t has any other name. Still a bug :p

@hhugo
Copy link

hhugo commented Jan 12, 2018

It seems to be working now and gives better error messages:

type t = {a:int; b:string} [@@deriving xml];;
Error: Deriver fields is needed for xml, you need to add it before in the list

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants