411 REFERENCE · Wikibooks
99 Elm Problems/Problem 8/Solutions
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
Solution 1: Recursive version
compress list =
case list of
[] -> []
[ first ] -> [ first ]
first :: next :: tail ->
if first == next then
compress (next :: tail)
else
first :: compress (next :: tail)