I'm making a function that removes elements that occur two or more times in a row in a list. It replaces them with one occurrence. I'm using only recursion and pattern matching (no library list functions).
Examples of how the function should work:
unrepeat [True,True,True,True]
-->[True]
unrepeat [1,1,2,1,3,3,3]
-->[1,2,1,3]
What I have so far:
unrepeat :: Eq a => [a] -> [a]
unrepeat [] = []
unrepeat [x] = [x]
unrepeat (x:xs) = x : [ k | k <- unrepeat(xs), k /=x]