adamc@40: signature S = sig adamc@40: type t adamc@40: val z : t adamc@40: val s : t -> t adamc@40: end adamc@40: adamc@40: signature T = sig adamc@40: type t adamc@40: val three : t adamc@40: end adamc@40: adamc@42: functor F (M : S) : T where type t = M.t = struct adamc@41: type t = M.t adamc@40: val three = M.s (M.s (M.s M.z)) adamc@40: end adamc@43: adamc@44: adamc@44: structure O = F (struct adamc@44: type t = int adamc@44: val z = 0 adamc@44: val s = fn x : t => x adamc@44: end) adamc@44: val three : int = O.three adamc@44: adamc@44: structure S = struct adamc@44: type t = int adamc@44: val z = 0 adamc@44: val s = fn x : t => x adamc@44: end adamc@44: structure SO = F (S) adamc@44: val three : int = SO.three adamc@44: adamc@44: structure SS : S = S adamc@44: structure SSO = F (SS) adamc@44: val three : SS.t = SSO.three adamc@47: adamc@47: val main = three