-- | This combinator combines 'getBoundVars' with the 'mfmap' function.
hfmapBoundVars :: forall f a b v i . (HasVars f v, HTraversable f)
                  => (Set v -> a :-> b) -> f a i -> f b i
hfmapBoundVars f t = let n :: f (Numbered a) i
                         n = number t
                         m = bindsVars n
                         trans :: Numbered a :-> b
                         trans (Numbered i x) = f (lookupNumMap Set.empty i m) x
                     in hfmap trans n
hfmapBoundVars :: forall f a b v i . (HasVars f v, HTraversable f)
                  => (Set v -> a :-> b) -> f a i -> f b i
hfmapBoundVars f t = let n :: f (Numbered a) i
                         n = number t
                         m = bindsVars n
                         trans :: Numbered a :-> b
                         trans (Numbered i x) = f (lookupNumMap Set.empty i m) x
                     in hfmap trans n
hfmapBoundVars f t = let n :: f (Numbered a) i
                         n = number t
                         m = bindsVars n
                         trans :: Numbered a :-> b
                         trans (Numbered i x) = f (lookupNumMap Set.empty i m) x
                     in hfmap trans n