From: simonpj Date: Wed, 2 Feb 2005 13:47:24 +0000 (+0000) Subject: [project @ 2005-02-02 13:47:24 by simonpj] X-Git-Tag: nhc98-1-18-release~37 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;ds=sidebyside;h=9185a42d2848131d1272e79cf1e04430fb96b6d0;hp=a494f0beb57477fbf5395e95dd7c55ba16882f63;p=ghc-base.git [project @ 2005-02-02 13:47:24 by simonpj] 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 --- diff --git a/Data/Generics/Schemes.hs b/Data/Generics/Schemes.hs index c783d4a..5234b01 100644 --- a/Data/Generics/Schemes.hs +++ b/Data/Generics/Schemes.hs @@ -157,7 +157,7 @@ gtypecount (_::a) = gcount (False `mkQ` (\(_::a) -> True)) -- | 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)