1 year ago

#192065

test-img

blueconch

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"

sml

smlnj

0 Answers

Your Answer

Accepted video resources