Hey David,<br><br>For instance:<br><br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex; font-family: courier new,monospace;" class="gmail_quote">arity :: (Data a) =&gt; a -&gt; Int<br>

arity = length . gmapQ (const ())<br></blockquote><br><br>Cheers,<br>Pedro<br><br><div class="gmail_quote">On Thu, Jun 25, 2009 at 17:31, David Fox <span dir="ltr">&lt;<a href="mailto:ddssff@gmail.com">ddssff@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Is it possible to determine the arity of a value&#39;s constructor?<br>Suppose I have a value x of type<br>

<br>  data A = B Int | C<br><br>They typeOf function returns its TypeRep, which contains its type<br>constructor, but I don&#39;t see how to decide whether that<br>
constructor&#39;s arity is 0 or 1.  If the type has field names<br>I can look at those using Data.Data.conFields and count them,<br>but if it doesn&#39;t I don&#39;t see how to do it.<br><font color="#888888"><br>-david<br>

<br>
</font><br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br>