Re: gfindtype type
Let me restate: gfindtype's declaration should be gfindtype :: (Data x, Typeable y) = x - Maybe y Jim ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
gfindtype type
Why is gfindtype :: (Data x, Data y) = x - Maybe y and not gfindtype :: (Data x, Typeable y) = x - Maybe y ? Jim Apple ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: gfindtype type
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. gfindtype abc :: Maybe Char -- yields Just 'a' gfindtype abc :: Maybe String -- yields Just bc HTH, Stefan ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: gfindtype type
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
Re: gfindtype type
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