Typeable is a superclass of Data.
So you would indeed imply Typeable by requiring Data.
However, you don't _need_ Data but only Typeable.
You need "Data x" to find "Typeable y"; once you find
"y" you don't need to _traverse_ any further into "y".
To summarise, requiring Typeable is simply more precise
as to what's needed.

Ralf

Stefan Holdermans wrote:

Jim,

Why is

gfindtype :: (Data x, Data y) => x -> Maybe y

and not

gfindtype :: (Data x, Typeable y) => x -> Maybe y

?


Because you're not always interested in a subterm of the same type as the parent node.


Ouch, answered your question before I really read it, i.e., before a first cup of coffee.

Sorry.

Regards,

Stefan

_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



-- Ralf Laemmel VU & CWI, Amsterdam, The Netherlands http://www.cs.vu.nl/~ralf/


_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to