Skip to content

How do [@with] replacements work with module types? #91

@CPCTC

Description

@CPCTC

The documentation says:

For module types, the replacements are specified using the standard with construct.

Does that mean, like this?

(* a.ml *)
module type T = sig
    type t = string;;
end;;

(* b.ml *)
module type TT = [%import: (module A.T with type t = int)];;
module T: TT = struct
    type t = int
end;;

I tried that, but it doesn't look like any replacement is happening.

File "b.ml", lines 2-4, characters 15-3:
2 | ...............struct
3 |     type t = int
4 | end..
Error: Signature mismatch:
       Modules do not match: sig type t = int end is not included in TT
       Type declarations do not match:
         type t = int
       is not included in
         type t = string
       The type t is not equal to the type string
       File "a.ml", line 2, characters 4-19: Expected declaration
       File "b.ml", line 3, characters 4-16: Actual declaration

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions