Extracting constructor name

Gracjan Polak gracjanpolak at gmail.com
Tue Sep 27 18:40:52 CEST 2011

Hi all,

To get a bit better error reporting and debugging I'd like to report constructor
names misused. Example:

data X = A | B Int | C String

magic A = doSomething
magic x = error $ "magic can only be used on A, you supplied " ++ constrName x

I'm missing constrName that returns only constructor name as string, skips all
fields (if any).


More information about the Libraries mailing list