Haskell how to delete duplicate element in list Code Example
haskell how to delete duplicate element in list
rmdups :: (Ord a) => [a] -> [a]
rmdups l = map (head ( group ( sort l)))
-- first you sort the list, then you group all elements that are equal and then you take the first element of each list