Added gdepth to determine depth of a term.
-- * Generic operations to reify terms
glength,
+ gdepth,
gcount,
gnodecount,
gtypecount,
glength = length . gmapQ (const ())
+-- | Determine depth of the given term
+gdepth :: GenericQ Int
+gdepth = (+) 1 . foldr max 0 . gmapQ gdepth
+
+
-- | Determine the number of all suitable nodes in a given term
gcount :: GenericQ Bool -> GenericQ Int
gcount p = everything (+) (\x -> if p x then 1 else 0)