gfindtype type

Stefan Holdermans sholderm at students.cs.uu.nl
Thu Jan 27 02:24:08 EST 2005


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



More information about the Glasgow-haskell-users mailing list