Created
June 17, 2021 15:15
-
-
Save EduardoRFS/6574fbcfd30373e8135980320310d95e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module type S1 = sig | |
val row_a : int | |
val row_b : float | |
end | |
module type S2 = sig | |
val row_b : float | |
val row_a : int | |
end | |
module type V = sig | |
val row_a : int | |
end | |
let f_poly ((module V: V)) = | |
Printf.printf "row_a: %d\n%!" V.row_a | |
let s1 = (module struct | |
let row_a = 1 | |
let row_b = 1.0 | |
end: S1) | |
let s2 = (module (val s1) : S2) | |
let () = f_poly (module (val s1)) | |
let () = f_poly (module (val s2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment