Created
August 29, 2013 15:18
-
-
Save hcarty/6379435 to your computer and use it in GitHub Desktop.
Modules from modules
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 S = sig | |
type t | |
end | |
module type Sout = sig | |
type a | |
type b | |
type t = A of a | B of b | |
end | |
let make : type ta tb. (module S with type t = ta) -> (module S with type t = tb) -> (module Sout with type a = ta) = | |
fun (module Ma) (module Mb) -> | |
let module Mab = | |
struct | |
type a = Ma.t | |
type b = Mb.t | |
type t = A of Ma.t | B of Mb.t | |
end | |
in | |
let m = (module Mab : Sout with type a = Ma.t) in | |
m |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment