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

Allow open (struct ... end) in mli files #13564

Open
kit-ty-kate opened this issue Oct 21, 2024 · 1 comment
Open

Allow open (struct ... end) in mli files #13564

kit-ty-kate opened this issue Oct 21, 2024 · 1 comment

Comments

@kit-ty-kate
Copy link
Member

#2147 added the ability to say open (struct ... end) in OCaml, however this expression is only available in the ml files, not the mli files.

This could be useful in the following example:

open (struct
  module ShortAlias = Some.VeryLongModule.Name
  type some_type_alias = string
end)

val f : some_type_alias -> ShortAlias.t -> t

where someone needs a type or module alias but doesn't want to pollute the interface itself with said aliases or unnecessary open.

@yallop
Copy link
Member

yallop commented Oct 21, 2024

This particular example can be written using :=:

module ShortAlias := Some.VeryLongModule.Name
type some_type_alias := string

val f : some_type_alias -> ShortAlias.t -> t

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

2 participants