foldBindsOfType :: (Monoid r)
                => GHC.Type -> (GHC.LHsBind GHC.Id -> r)
                -> GHC.LHsBinds GHC.Id -> r
foldBindsOfType ty f = everything mappend (mempty `mkQ` go)
  where
    go bind@(L _ (GHC.FunBind {GHC.fun_id=L _ fid}))
      | GHC.idType fid `Type.eqType` ty = f bind
    go _ = mempty
foldBindsOfType :: (Monoid r)
                => GHC.Type -> (GHC.LHsBind GHC.Id -> r)
                -> GHC.LHsBinds GHC.Id -> r
foldBindsOfType ty f = everything mappend (mempty `mkQ` go)
  where
    go bind@(L _ (GHC.FunBind {GHC.fun_id=L _ fid}))
      | GHC.idType fid `Type.eqType` ty = f bind
    go _ = mempty
foldBindsOfType ty f = everything mappend (mempty `mkQ` go)
  where
    go bind@(L _ (GHC.FunBind {GHC.fun_id=L _ fid}))
      | GHC.idType fid `Type.eqType` ty = f bind
    go _ = mempty