[Haskell-beginners] Generalised data constructor matching

Chaddaï Fouché chaddai.fouche at gmail.com
Sat Sep 5 03:53:34 EDT 2009


On Fri, Sep 4, 2009 at 2:57 PM, Daniel Fischer<daniel.is.fischer at web.de> wrote:
> In general: not.
> The problem is that potentially every datatype can be made an instance of the class, so in
> the default implementations, you can only[*] use functions which work on every datatype.
> There aren't many interesting functions that do.
>
> [*]well, you can also use methods of the class and superclasses.

And so by using Data and Typeable as superclasses, he could do what he
is asking for... And Data and Typeable are automatically derivables by
GHC (extension).

-- 
Jedaï


More information about the Beginners mailing list