sml - How to have more than one type in ML? -


is possible in ml allow variable in ml have more 1 type?

for instance, if want node in tree int or string.

node of int * string 

i tried results in tuple type of (int, string). don't want tuple, either int or string. allowed?

as pointed out in comment, feature you're looking union types. believe syntax them in sml is:

datatype node = intnode of int               | stringnode of string 

Comments

Popular posts from this blog

php - Autoloader issue not returning Class -

python - Getting next two indexes regardless of current index -

ruby - Prevent Custom Validation Error on Association -