[Haskell-beginners] discover data constructor without pattern matching?

Philippe Sismondi psismondi at arqux.com
Thu Dec 1 23:38:05 CET 2011


Is it possible to discover the data constructor used to make a value without doing pattern matching?

In my current small project I have a data type with a zillion constructors. These use record syntax so that I can access the payload without pattern matching. But I just discovered that it I want to print out the constructor name in my error handling function. Can I do this without, say, hacking around with a string from 'show'?

- P -


More information about the Beginners mailing list