Last active
October 1, 2016 19:35
-
-
Save igstan/c566eecc38784216f1499bfe8d91f4c4 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
functor Member(Flag : sig type t end) = | |
struct | |
(* Define types and values common to both MemberA and MemberB. *) | |
end | |
(* | |
* MemberA and MemberB differ only in the declaration of Flag, the rest of | |
* the types and values are the same and come from the Member functor. | |
*) | |
structure MemberA = | |
struct | |
structure Flag = | |
struct | |
datatype t = FlagA1 | FlagA2 | |
end | |
(* Mix in the types and values defined by Member. *) | |
structure M = Member(Flag) open M | |
end | |
structure MemberB = | |
struct | |
structure Flag = | |
struct | |
datatype t = FlagB1 | FlagB2 | |
end | |
(* Mix in the types and values defined by Member. *) | |
structure M = Member(Flag) open M | |
end | |
val a = MemberA.Flag.FlagA1 | |
val b = MemberB.Flag.FlagB1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment