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

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

Open
CPCTC opened this issue Jul 2, 2023 · 0 comments
Open

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

CPCTC opened this issue Jul 2, 2023 · 0 comments

Comments

@CPCTC
Copy link

CPCTC commented Jul 2, 2023

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant