summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
a494f0b)
Generalise gfindtype to
gfindtype :: (Data x, Typeable y) => x -> Maybe y
(It was (Data x, Data y) => ..., but there's no reason to
require Data y.)
Pointed out by Jim Apple
-- | Find (unambiguously) an immediate subterm of a given type
-- | Find (unambiguously) an immediate subterm of a given type
-gfindtype :: (Data x, Data y) => x -> Maybe y
+gfindtype :: (Data x, Typeable y) => x -> Maybe y
gfindtype = singleton
. foldl unJust []
. gmapQ (Nothing `mkQ` Just)
gfindtype = singleton
. foldl unJust []
. gmapQ (Nothing `mkQ` Just)