Remove consecutive duplicates from a list in Haskell

Suppose a given list of integers has some consecutive duplicate entries and it is required to remove those duplicates and to keep just one entry of that integer. This can be done in Haskell programming language using foldr or foldl functions. It can also be done …