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

Parametrized types not compiling #77

Closed
nickbetteridge opened this issue Nov 30, 2017 · 3 comments
Closed

Parametrized types not compiling #77

nickbetteridge opened this issue Nov 30, 2017 · 3 comments

Comments

@nickbetteridge
Copy link

Just a quick question - I'm trying to do bindings for Promise and I'm having trouble in setting up parametrisation - starting out with the notes in TYPES.md:

type 'a t
val t_to_js: ('a -> Ojs.t) -> 'a t -> Ojs.t
val t_of_js: (Ojs.t -> 'a) -> Ojs.t -> 'a t

I then compile with:

ocamlfind gen_js_api/gen_js_api js_promise.mli

and get:

File "js_promise.mli", line 3, characters 23-25:
Error: Cannot parse type

It seems that it doesn't like the 'a. Is there a work-around for this?

@nickbetteridge
Copy link
Author

Oops - missed off the [@@js.cast] , but the error remains :(

@nickbetteridge
Copy link
Author

Duh - of course it works - just noticed the $(OCAMLC) -c -I $(OJSDIR) -ppx "$(GENJSAPI) -ppx" main.ml in the makefile - I'm holding my head in shame - apologies for the unnecessary issue

@monstasat
Copy link

I have the same question about parametrized types.
When I try to generate *.ml file from *.mli with

ocamlfind gen_js_api/gen_js_api test.mli`

I get

Error: Cannot parse type

As I am new to gen_js_api, I didn't understand how it can be solved. As I understood, @nickbetteridge 's solution describes compilation of .ml file, but I am interested in using parametrized types in an .mli file. Is it possible?

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

2 participants