Copyright | (c) 2019-2021 Rudy Matela |
---|---|

License | 3-Clause BSD (see the file LICENSE) |

Maintainer | Rudy Matela <rudy@matela.com.br> |

Safe Haskell | Safe-Inferred |

Language | Haskell2010 |

Re-exports the Data.List module along with additional functions over lists.

# Documentation

nubSort :: Ord a => [a] -> [a] Source #

*O(n log n)*.
Sorts and remove repetitions.
Equivalent to `nub . sort`

.

> nubSort [1,2,3] [1,2,3] > nubSort [3,2,1] [1,2,3] > nubSort [3,2,1,3,2,1] [1,2,3] > nubSort [3,3,1,1,2,2] [1,2,3]

isPermutationOf :: Ord a => [a] -> [a] -> Bool Source #

*O(n log n)*.
Checks that all elements of the first list are elements of the second.

isSubsetOf :: Ord a => [a] -> [a] -> Bool Source #

*O(n log n)*.
Checks that all elements of the first list are elements of the second.

isNub :: Ord a => [a] -> Bool Source #

*O(n log n)*.
Checks that all elements are unique.
This function is a faster equivalent to the following:

isNub xs = nub xs == xs

Examples:

isNub [] = True isNub [1,2,3] = True isNub [2,1,2] = False

lookupId :: Eq a => a -> [(a, a)] -> a Source #

*O(n)*.
Like `lookup`

but returns the key itself if nothing is found.

> lookupId 5 [(1,2),(3,4)] 5

> lookupId 5 [(1,2),(3,4),(5,6)] 6

(+++) :: Ord a => [a] -> [a] -> [a] infixr 5 Source #

Merges two lists discarding repeated elements.

The argument lists need to be in order.

> [1,10,100] +++ [9,10,11] [1,9,10,11,100]

module Data.List