
25 Jun
2009
25 Jun
'09
3:31 p.m.
Is it possible to determine the arity of a value's constructor? Suppose I have a value x of type data A = B Int | C They typeOf function returns its TypeRep, which contains its type constructor, but I don't see how to decide whether that constructor's arity is 0 or 1. If the type has field names I can look at those using Data.Data.conFields and count them, but if it doesn't I don't see how to do it. -david