'Printing constructor name in SML
I would like to know whether there would be a way to print the name of the constructor of a datatype from a function in SML. I could find ways to do this in Haskell by deriving the datatype from libraries like show but not in SML.
I need this because I have a very large datatype with lots of constructors which needs to pretty print the data from a function.
Hence the below code wouldn't work for me.
fun print (Cons of var) = "cons"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
