X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Data%2FIntSet.hs;h=36cac361a07f717f03a9aeba141b5494253c573b;hb=93b9a4ab1adffb656b3f65ac5a9ebe89d10adef8;hp=720b93782243bbf69b3e9ca21013e9a1c4b1af4c;hpb=2701ac4127cbc37e6d1069e2f5240a1e0ec1e479;p=ghc-base.git diff --git a/Data/IntSet.hs b/Data/IntSet.hs index 720b937..36cac36 100644 --- a/Data/IntSet.hs +++ b/Data/IntSet.hs @@ -10,10 +10,11 @@ -- -- An efficient implementation of integer sets. -- --- This module is intended to be imported @qualified@, to avoid name --- clashes with "Prelude" functions. eg. +-- Since many function names (but not the type name) clash with +-- "Prelude" names, this module is usually imported @qualified@, e.g. -- --- > import Data.IntSet as Set +-- > import Data.IntSet (IntSet) +-- > import qualified Data.IntSet as IntSet -- -- The implementation is based on /big-endian patricia trees/. This data -- structure performs especially well on binary operations like 'union' @@ -46,6 +47,7 @@ module Data.IntSet ( , null , size , member + , notMember , isSubsetOf , isProperSubsetOf @@ -209,6 +211,10 @@ member x t Tip y -> (x==y) Nil -> False +-- | /O(log n)/. Is the element not in the set? +notMember :: Int -> IntSet -> Bool +notMember k = not . member k + -- 'lookup' is used by 'intersection' for left-biasing lookup :: Int -> IntSet -> Maybe Int lookup k t