Using Haskell, I need: -- | Produce a list where sequences of repeated elements in the given list are replaced by just one of the repeated element. Where the result of the following compress statement >>> compress [1,1,1,2,3,3,3,1,2,2,2,2] results in: -- [1,2,3,1,2] Solution Look the simple logic which we can apply to this problem is to find the repeating element in the list unitl we didnt get the next distinct element Once we get that element we stop comparing and stroes the index of that distinct element and will add the repeating element (the element on which we wereworking beforing getting the element) to the new compressed list For example list [1,1,1,1,2,2,3,3] we wnt to compress the list start with first element ie 1 and keep itrerating until we get 2 once we traversed to this element we stop traversing stores the index of element 2 now we will add 1 in compressed list and will do the same with rest of the elements in the list now next repeating element search will starts from the index whih we saves by getting the dinsctint element .