Skip to content

Instantly share code, notes, and snippets.

@EduardoRFS
Created June 17, 2021 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EduardoRFS/6574fbcfd30373e8135980320310d95e to your computer and use it in GitHub Desktop.
Save EduardoRFS/6574fbcfd30373e8135980320310d95e to your computer and use it in GitHub Desktop.
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