substStack :: Stack -> Peg Stack
substStack s = flip map s . f <$> getVarBindings
  where f m (V n) | Just x <- n `M.lookup` m = x
        f _ x = x
substStack :: Stack -> Peg Stack
substStack s = flip map s . f <$> getVarBindings
  where f m (V n) | Just x <- n `M.lookup` m = x
        f _ x = x
substStack s = flip map s . f <$> getVarBindings
  where f m (V n) | Just x <- n `M.lookup` m = x
        f _ x = x