foldBindsContainingIdent :: Monoid r
                         => GHC.Id -> (GHC.LHsBind GHC.Id -> r)
                         -> GHC.LHsBinds GHC.Id -> r
foldBindsContainingIdent ident f = everything mappend (mempty `mkQ` go)
  where
    go bind
      | getAny $ everything mappend (mempty `mkQ` containsId) bind = f bind
      where
        containsId ident' | ident == ident' = Any True
        containsId _                        = mempty
    go _ = mempty
foldBindsContainingIdent :: Monoid r
                         => GHC.Id -> (GHC.LHsBind GHC.Id -> r)
                         -> GHC.LHsBinds GHC.Id -> r
foldBindsContainingIdent ident f = everything mappend (mempty `mkQ` go)
  where
    go bind
      | getAny $ everything mappend (mempty `mkQ` containsId) bind = f bind
      where
        containsId ident' | ident == ident' = Any True
        containsId _                        = mempty
    go _ = mempty
foldBindsContainingIdent ident f = everything mappend (mempty `mkQ` go)
  where
    go bind
      | getAny $ everything mappend (mempty `mkQ` containsId) bind = f bind
      where
        containsId ident' | ident == ident' = Any True
        containsId _                        = mempty
    go _ = mempty