
27 Sep
2011
27 Sep
'11
3:31 p.m.
Gracjan Polak schrieb:
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
Maybe it is better then to have three distinct types A, B, C and provide a type class like Magic for the functionality that is only provided by A.