module <name> =
struct
..
end;;
module type <name> =
struct (* should have been sig *)
..
end;;
module <name> = struct .. end;; module type <name> = struct (* should have
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The first declares a module and the second declares a module type (aka a signature). A module type contains
typeandvaldeclarations, whereas a module can contain definitions (e.g.,letbindings). You can use a signature to restrict the type of a module, much as you might for a function. For example,Now, we have
M.gis unbound because it’s hidden by the signatureT.Another common way to use module types is as arguments to and return values of functors. For example, the
Map.Makefunctor in the standard library takes a module with signatureMap.OrderedTypeand creates a module with signatureMap.SP.S. Note that there’s a mistake in the question. A module type is declared using