localFreeIds :: (Applicative f, Lens.Contravariant f, Monad m)
             => RewriteMonad m ((TmName -> f TmName) -> Term -> f Term)
localFreeIds = do
  globalBndrs <- Lens.use bindings
  return ((termFreeIds . Lens.filtered (not . (`HML.member` globalBndrs))))

-- | Lift the binders in a let-binding to a global function that have a certain
-- property
localFreeIds :: (Applicative f, Lens.Contravariant f, Monad m)
             => RewriteMonad m ((TmName -> f TmName) -> Term -> f Term)
localFreeIds = do
  globalBndrs <- Lens.use bindings
  return ((termFreeIds . Lens.filtered (not . (`HML.member` globalBndrs))))

-- | Lift the binders in a let-binding to a global function that have a certain
-- property
localFreeIds = do
  globalBndrs <- Lens.use bindings
  return ((termFreeIds . Lens.filtered (not . (`HML.member` globalBndrs))))

-- | Lift the binders in a let-binding to a global function that have a certain
-- property