[Haskell-cafe] Introspection on types.

Derek Elkins derek.a.elkins at gmail.com
Thu Oct 1 19:43:59 EDT 2009


On Thu, Oct 1, 2009 at 6:22 PM, Gregory Propf <gregorypropf at yahoo.com> wrote:
>
> Is there a way to tell, let's say, how many constructors there are for a type?  Or do I need one of the haskell extensions I've read about?

Use Data.Data and derive Data for the types you are interested in or
instance it for pre-existing types that aren't already instances.
Introspection is tedious but trivial.

http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data-Data.html


More information about the Haskell-Cafe mailing list