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
-gfindtype :: (Data x, Data y) => x -> Maybe y
+gfindtype :: (Data x, Typeable y) => x -> Maybe y
gfindtype = singleton
. foldl unJust []
. gmapQ (Nothing `mkQ` Just)