/* before */
let thing: (module Thing) = (module MyModule);
/* after */
let thing: Thing = (module MyModule);
Idea: the (module Thing) package type constraint syntax looks very foreign. Since modules are usually associated with an uppercase-cased first letter identifier, the package type constraint syntax can probably be simplified to just using the uppercase-cased first letter identifier (with possible dot for submodules).
The grammar needs to be a little bit restructured to make this work. Currently module types can be lower cased too, (module thing) is legal Ocaml for some reason, resulting in a reduce/reduce conflict.
/* ambiguity */
let thing: foo = (module Thing);
/* is foo a module type or is it a core_type */
By special casing this case to accept uppercase identifiers in the module type case, the grammar could possibly allow parsing of let thing: Thing = (module MyModule); without too much trouble.
I'm kinda suspecting that newcomers would accidentally mistake that type for a variant or something. Happens often enough in other cases. Like, how would you explain this feature? (Actually asking. Maybe it's not that confusing?)
I might have been prematurely excited by finding something that did not lead to a shift/reduce conflict in the current grammar. 馃槄Yes, it might will be confusing for newcomers. They already have a lot of stuff to learn. It's better to at least parse the "short form" and print the module keyword with refmt.
Most helpful comment
I might have been prematurely excited by finding something that did not lead to a shift/reduce conflict in the current grammar. 馃槄Yes, it
mightwill be confusing for newcomers. They already have a lot of stuff to learn. It's better to at least parse the "short form" and print themodulekeyword with refmt.