Skip to content

Support canonical on module types, types, etc. #558

Closed
@lpw25

Description

@lpw25

Currently @canonical only works on modules. It is used to undo the namespacing games that dune does, but it is also useful more generally for cases where a module is exposed in a library at a different name. For example, something like this is a common pattern:

You have a foo0.ml:

module M = struct ... end
...

You have a foo.mli:

module M = Foo0.M
...

The library exposes Foo as e.g. Bar.Foo but does not expose Foo0. By default references to Foo0.M become unresolved links, but they can easily be fixed, by changing foo0.ml to:

(** @canonical Bar.Foo.M *)
module M = struct ... end
...

However, there is currently no way to fix the similar case where Foo0.M is a module type:

module type M = sig ... end
...

because @canonical does not work on module types.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions