I think your example isn’t correct, the `us` variable is only defined for the last clause. The first two should use `compress ys`.
Without as-patterns this would look like:
compress (x:y:ys’)
| x==y = compress (y:ys’)
| otherwise = x : compress (y:ys’)
compress us = us
It can be more efficient and concise to use ys@(y:_) in the pattern match and ys elsewhere instead of having to repeat (y:ys’) which without optimizations would call the : constructor again and may not share memory in the same way.
-bob