structure MyStuff = struct datatype MyNum = MyInt of int | MyReal of real; val myZero = MyInt(0); fun myAdd(MyInt(x), MyInt(y)) = MyInt(x+y) | myAdd(MyInt(x), MyReal(y)) = MyReal(real(x) + y) | myAdd(MyReal(x), MyInt(y)) = MyReal(x + real(y)) | myAdd(MyReal(x), MyReal(y)) = MyReal(x + y); end; val seal = MyStuff.MyReal(3.14159); val bear = MyStuff.MyInt(21.0); val theFreakishSealBear = MyStuff.myAdd(seal, bear); fun ocean() = let (* open within this let declaration only *) open MyStuff; val whale = myAdd(MyInt(5), MyReal(5.0)); in myAdd(whale, MyInt(100)) end; (* the following remains illegal *) val aZero = myZero;