substAll bs x = foldr f x bs
  where f (v@(V _), x) = substs v [x]
        f (s@(S _), L x) = substs s x
        f _ = id
substAll bs x = foldr f x bs
  where f (v@(V _), x) = substs v [x]
        f (s@(S _), L x) = substs s x
        f _ = id
substAll bs x = foldr f x bs
  where f (v@(V _), x) = substs v [x]
        f (s@(S _), L x) = substs s x
        f _ = id