Unique-0.1.0.0: Provides with the functionality like unix "uniq" utility

Copyright(c) Volodymyr Yaschenko
LicenseBSD3
Maintainerualinuxcn@gmail.com
StabilityUnstable
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.List.Unique

Description

 

Synopsis

Documentation

sortUniq :: Ord a => [a] -> [a] Source

sortUniq sorts the list and removes the duplicates of elements. Example:

sortUniq "foo bar" == " abfor"

repeated :: Ord a => [a] -> [a] Source

repeated finds only the elements that are present more than once in the list. Example:

repeated "foo bar" == "o"

unique :: Ord a => [a] -> [a] Source

unique gets only unique elements, those that do not have duplicates. It sorts them. Example:

unique "foo bar" == " abfr"

count :: Ord a => [a] -> [(a, Int)] Source

count the elements in the list, 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)] Source

count_ the elements in the list, sorts by values. Example:

count_ "foo bar" == [(' ',1),(a,1),(b,1),(f,1),(r,1),(o,2)]

countElem :: Ord a => a -> [a] -> Maybe Int Source

countElem gets the amount of occurrences of the specified element. Example:

countElem o "foo bar" == Just 2