SML is statically-typed, so the type of any value in the program is statically known at compile time. I'm not sure what you want when you want to "print it out".
Maybe you can't figure out by looking at the code yourself what the type of something is. When you define a value at the top level into the interpreter, either directly or if you load a file using use "whatever.sml";
, the interpreter will tell you the type that is inferred for that value.
Alternately, if you have a piece of code, you can post it (and also any code it depends on) here and we can help you figure out what type a particular value in it has.
If you want to ensure that a particular value is a certain type, you can use type guards: (expression : type)
is the same thing as expression
, except that during type checking it will make sure that that expression is that type.
If you want to somehow get type information at runtime, I don't think you can, and you shouldn't need to, because it's already known at compile time.