-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | It provides the functionality like unix "uniq" utility -- -- Library provides the functions to find unique and duplicate elements -- in the list @package Unique @version 0.4.7 -- | Library provides functions to find unique and duplicate elements in -- the list. Unlike Unique or UniqueStrict modules this one uses -- Data.HashMap.Strict for calculation. -- -- The elements in the list can be unsorted (do not have an instance of -- Ord class, but Hashable is needed). This implementation is good for -- ByteStrings. module Data.List.UniqueUnsorted -- | repeated finds only the elements that are present more than -- once in the list. Example: -- --
-- repeated "foo bar" == "o" --repeated :: (Hashable a, Eq a) => [a] -> [a] -- | The repeatedBy function behaves just like repeated, -- except it uses a user-supplied equality predicate. -- --
-- repeatedBy (>2) "This is the test line" == " stei" --repeatedBy :: (Hashable a, Eq a) => (Int -> Bool) -> [a] -> [a] -- | unique gets only unique elements, that do not have duplicates. -- --
-- unique "foo bar" == " abrf" --unique :: (Hashable a, Eq a) => [a] -> [a] -- | count of each element in the list. Example: -- --
-- count "This is the test line" == [(' ',4),('s',3),('T',1),('t',3),('e',3),('h',2),('i',3),('l',1),('n',1)]
--
count :: (Hashable a, Eq a) => [a] -> [(a, Int)]
-- | count_ of each elements in the list, it sorts by their number.
-- Example:
--
--
-- count_ "This is the test line" == [('n',1),('l',1),('T',1),('h',2),('i',3),('e',3),('t',3),('s',3),(' ',4)]
--
count_ :: (Hashable a, Eq a) => [a] -> [(a, Int)]
-- | Library provides functions to find unique and duplicate elements in
-- the list. Unlike Data.List.Unique this one uses Data.Map.Strict for
-- calculations. So it's much faster and it uses less memory.
module Data.List.UniqueStrict
-- | repeated finds only the elements that are present more than
-- once in the list. Example:
--
-- -- repeated "foo bar" == "o" --repeated :: Ord a => [a] -> [a] -- | The repeatedBy function behaves just like repeated, except it -- uses a user-supplied equality predicate. -- --
-- repeatedBy (>2) "This is the test line" == " eist" --repeatedBy :: Ord a => (Int -> Bool) -> [a] -> [a] -- | unique gets only unique elements, that do not have duplicates. -- It sorts them. Example: -- --
-- unique "foo bar" == " abfr" --unique :: Ord a => [a] -> [a] -- | count of each element in the list, it sorts by keys (elements). -- Example: -- --
-- count "foo bar" == [(' ',1),('a',1),('b',1),('f',1),('o',2),('r',1)]
--
count :: Ord a => [a] -> [(a, Int)]
-- | count_ of each elements in the list, it sorts by their number.
-- Example:
--
--
-- count_ "foo bar" == [(' ',1),('a',1),('b',1),('f',1),('r',1),('o',2)]
--
count_ :: Ord a => [a] -> [(a, Int)]
-- | Library provides the functions to find unique and duplicate elements
-- in the list
module Data.List.Unique
-- | complex function is a complex investigation of the list. It
-- returns triple:
--
--
-- complex "This is the test line" == ("This teln","is hte","Tln")
--
--
-- Since 0.4.4
complex :: Eq a => [a] -> ([a], [a], [a])
-- | isUnique function is to check whether the given element is
-- unique in the list or not.
--
-- It returns Nothing when the element does not present in the list.
-- Examples:
--
-- -- isUnique 'f' "foo bar" == Just True -- isUnique 'o' "foo bar" == Just False -- isUnique '!' "foo bar" == Nothing ---- -- Since 0.4.5 isUnique :: Eq a => a -> [a] -> Maybe Bool -- | isRepeated is a reverse function to isUnique -- -- Since 0.4.5 isRepeated :: Eq a => a -> [a] -> Maybe Bool -- | sortUniq sorts the list and removes the duplicates of elements. -- Example: -- --
-- sortUniq "foo bar" == " abfor" --sortUniq :: Ord a => [a] -> [a] -- | repeated finds only the elements that are present more than -- once in the list. Example: -- --
-- repeated "foo bar" == "o" --repeated :: Ord a => [a] -> [a] -- | The repeatedBy function behaves just like repeated, except it uses a -- user-supplied equality predicate. -- --
-- repeatedBy (>2) "This is the test line" == " eist" --repeatedBy :: Ord a => (Int -> Bool) -> [a] -> [a] -- | unique gets only unique elements, that do not have duplicates. -- It sorts them. Example: -- --
-- unique "foo bar" == " abfr" --unique :: Ord a => [a] -> [a] -- | allUnique checks whether all elements of the list are unique -- --
-- allUnique "foo bar" == False -- allUnique ['a'..'z'] == True -- allUnique [] == True (!) ---- -- Since 0.4.7 allUnique :: Ord a => [a] -> Bool -- | count of each element in the list, it sorts by keys (elements). -- Example: -- --
-- count "foo bar" == [(' ',1),('a',1),('b',1),('f',1),('o',2),('r',1)]
--
count :: Ord a => [a] -> [(a, Int)]
-- | count_ of each elements in the list, it sorts by their number.
-- Example:
--
--
-- count_ "foo bar" == [(' ',1),('a',1),('b',1),('f',1),('r',1),('o',2)]
--
count_ :: Ord a => [a] -> [(a, Int)]
-- | occurrences like count or count_ but shows the
-- list of elements that occur X times
--
-- -- occurrences "This is the test line" == [(1,"Tln"),(2,"h"),(3,"eist"),(4," ")] ---- -- Since 0.4.4 occurrences :: Ord a => [a] -> [(Int, [a])] -- | countElem gets the number of occurrences of the specified -- element. Example: -- --
-- countElem 'o' "foo bar" == 2 --countElem :: Eq a => a -> [a] -> Int