HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleghc-9.10.3GHC2021

GHC.Data.List.SetOps

Set-like operations on lists

Avoid using them as much as possible

  • 1 type
  • 17 values
  • Packageghc-9.10.3
  • Exports18
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceSetOps.hs
valueunionListsOrd
  1. :: (HasDebugCallStack, Outputable a, Ord a)
  2. => [a]
  3. -> [a]
  4. -> [a]
#

Combines the two lists while keeping their order, placing the first argument first in the result.

Uses a set internally to record duplicates. This makes it slightly slower for very small lists but avoids quadratic behaviour for large lists.

valueminusList :: Ord a => [a] -> [a] -> [a]
#

Calculate the set difference of two lists. This is O((m + n) log n), where we subtract a list of n elements from a list of m elements.

Extremely short cases are handled specially: When m or n is 0, this takes O(1) time. When m is 1, it takes O(n) time.

typetype Assoc a b = [(a, b)]
#

A finite mapping based on equality and association lists.

valueremoveDups :: (a -> a -> Ordering) -> [a] -> ([a], [NonEmpty a])
#

Remove the duplicates from a list using the provided comparison function. Might change the order of elements.

Returns the list without duplicates, and accumulates all the duplicates in the second component of its result.

valuenubOrdBy :: (a -> a -> Ordering) -> [a] -> [a]
#

Remove the duplicates from a list using the provided comparison function.