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

could "module type of" filter _ and () values ? #6785

Closed
vicuna opened this issue Feb 17, 2015 · 3 comments
Closed

could "module type of" filter _ and () values ? #6785

vicuna opened this issue Feb 17, 2015 · 3 comments

Comments

@vicuna
Copy link

vicuna commented Feb 17, 2015

Original bug ID: 6785
Reporter: @zoggy
Status: closed (set by @zoggy on 2015-02-18T07:06:53Z)
Resolution: not a bug
Priority: normal
Severity: minor
Category: typing
Monitored by: @whitequark @hcarty

Bug description

Hello,

Using some ppx extension and "module type of" construct, I end up with:

   The value `()' is required but not provided

To try it, I attach files m.ml and m.mli. To compile, you need ppx_deriving_yojson.

$ ocamlfind ocamlc -c -package ppx_deriving_yojson m.mli
$ ocamlfind ocamlc -c -package ppx_deriving_yojson m.ml
File "m.ml", line 1:
Error: The implementation m.ml does not match the interface m.cmi:
...
At position module type P =
The value `()' is required but not provided
File "m.ml", line 9, characters 4-61: Expected declaration

Note that if there is no .mli, compiling m.ml does not raise any problem.

File attachments

@vicuna
Copy link
Author

vicuna commented Feb 17, 2015

Comment author: @zoggy

The problem is the same if the ppx extension generates code with the form

let _ = ...

instead of

let () = ...

It would not be that important if it was possible to define values like

val () : unit
or
val _ : unit

but it is not possible.

@vicuna
Copy link
Author

vicuna commented Feb 17, 2015

Comment author: @sliquister

What you ask for doesn't make sense. The module type of [struct let () = .. let _ = .. end] is [sig end], there is nothing to filter out.
Maybe the ppx rewriter is creating identifiers called "()" or "_" instead of proper patterns.

@vicuna
Copy link
Author

vicuna commented Feb 18, 2015

Comment author: @zoggy

Indeed, this was the case. I used a variable called "()" (or "_") rather than the constructor "()" (or the any pattern).
Regarding the error message, I thought that something was missing in the .ml file wrt to the mli file, but it was the contrary.

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

No branches or pull requests

1 participant