The error message is not because @Tom_H accidentally used GADT syntax, as far as I know you need : to tell the language “this is a gadt” and they still used of. Curiously enough, the error message reported here and the error message thrown by my version of the compiler are different. Mine just highlights the arrow and says “syntax error”. I find it treating Tree.stm as a type constructor assuming its input is the code present here surprising.
BTW, @Tom_H, both a * b -> c and a -> b -> c are valid (and theoretically equivalent) SML and OCaml function types. The use of either is simply by convention in the respective languages. In many SML implementations it happens that a * b -> c is slightly more efficient than a -> b -> c because the language has a (strictly specified) left-to-right argument evaluation order.
Thank you for your reply! Actually I didn’t know much about GADT and just tried to write the type as a function signature.
You are right, both a * b -> c and a -> b -> c works. I was wondering the difference between them and your explanation is just in time! Thank you again for your thoughtful explanation