-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | A specialization of `HashMap Int v`
--   
--   A specialization of `HashMap Int v`
@package unordered-intmap
@version 0.1.0.0

module Data.Unordered.IntMap

-- | A map from (possibly newtyped) Int keys to values. A map cannot
--   contain duplicate keys; each key can map to at most one value.
data UnorderedIntMap v
Empty :: UnorderedIntMap v
BitmapIndexed :: {-# UNPACK #-} !Bitmap -> {-# UNPACK #-} !(SmallArray (UnorderedIntMap v)) -> UnorderedIntMap v
Leaf :: {-# UNPACK #-} !(Leaf v) -> UnorderedIntMap v
Full :: {-# UNPACK #-} !(SmallArray (UnorderedIntMap v)) -> UnorderedIntMap v

-- | A set of values. A set cannot contain duplicate values.
data Leaf v
L :: {-# UNPACK #-} !Int -> v -> Leaf v

-- | <i>O(1)</i> Construct an empty map.
empty :: UnorderedIntMap v

-- | <i>O(1)</i> Construct a map with a single element.
singleton :: Coercible key Int => key -> v -> UnorderedIntMap v

-- | <i>O(1)</i> Return <a>True</a> if this map is empty, <a>False</a>
--   otherwise.
null :: UnorderedIntMap v -> Bool

-- | <i>O(n)</i> Return the number of key-value mappings in this map.
size :: UnorderedIntMap v -> Int

-- | <i>O(log n)</i> Return <a>True</a> if the specified key is present in
--   the map, <a>False</a> otherwise.
member :: Coercible key Int => key -> UnorderedIntMap a -> Bool

-- | <i>O(log n)</i> Return the value to which the specified key is mapped,
--   or <a>Nothing</a> if this map contains no mapping for the key.
lookup :: Coercible key Int => key -> UnorderedIntMap v -> Maybe v

-- | <i>O(log n)</i> Return the value to which the specified key is mapped,
--   or the default value if this map contains no mapping for the key.
lookupDefault :: Coercible key Int => v -> key -> UnorderedIntMap v -> v

-- | <i>O(log n)</i> Return the value to which the specified key is mapped.
--   Calls <a>error</a> if this map contains no mapping for the key.
(!) :: Coercible key Int => UnorderedIntMap v -> key -> v
infixl 9 !

-- | <i>O(log n)</i> Associate the specified value with the specified key
--   in this map. If this map previously contained a mapping for the key,
--   the old value is replaced.
insert :: Coercible key Int => key -> v -> UnorderedIntMap v -> UnorderedIntMap v

-- | <i>O(log n)</i> Associate the value with the key in this map. If this
--   map previously contained a mapping for the key, the old value is
--   replaced by the result of applying the given function to the new and
--   old value. Example:
--   
--   <pre>
--   insertWith f k v map
--     where f new old = new + old
--   </pre>
insertWith :: Coercible key Int => (v -> v -> v) -> key -> v -> UnorderedIntMap v -> UnorderedIntMap v

-- | In-place update version of insert
unsafeInsert :: Coercible key Int => key -> v -> UnorderedIntMap v -> UnorderedIntMap v

-- | <i>O(log n)</i> Remove the mapping for the specified key from this map
--   if present.
delete :: Coercible key Int => key -> UnorderedIntMap v -> UnorderedIntMap v

-- | <i>O(log n)</i> Adjust the value tied to a given key in this map only
--   if it is present. Otherwise, leave the map alone.
adjust :: Coercible key Int => (v -> v) -> key -> UnorderedIntMap v -> UnorderedIntMap v

-- | <i>O(log n)</i> The expression (<tt><a>update</a> f k map</tt>)
--   updates the value <tt>x</tt> at <tt>k</tt>, (if it is in the map). If
--   (f k x) is <tt><a>Nothing</a>, the element is deleted. If it is
--   (</tt><a>Just</a> y), the key k is bound to the new value y.
update :: Coercible key Int => (a -> Maybe a) -> key -> UnorderedIntMap a -> UnorderedIntMap a

-- | <i>O(log n)</i> The expression (<tt><a>alter</a> f k map</tt>) alters
--   the value <tt>x</tt> at <tt>k</tt>, or absence thereof. <tt>alter</tt>
--   can be used to insert, delete, or update a value in a map. In short :
--   <tt><a>lookup</a> k (<a>alter</a> f k m) = f (<a>lookup</a> k m)</tt>.
alter :: Coercible key Int => (Maybe v -> Maybe v) -> key -> UnorderedIntMap v -> UnorderedIntMap v

-- | <i>O(n+m)</i> The union of two maps. If a key occurs in both maps, the
--   mapping from the first will be the mapping in the result.
union :: UnorderedIntMap v -> UnorderedIntMap v -> UnorderedIntMap v

-- | <i>O(n+m)</i> The union of two maps. If a key occurs in both maps, the
--   provided function (first argument) will be used to compute the result.
unionWith :: forall v. (v -> v -> v) -> UnorderedIntMap v -> UnorderedIntMap v -> UnorderedIntMap v

-- | <i>O(n+m)</i> The union of two maps. If a key occurs in both maps, the
--   provided function (first argument) will be used to compute the result.
unionWithKey :: Coercible key Int => (key -> v -> v -> v) -> UnorderedIntMap v -> UnorderedIntMap v -> UnorderedIntMap v

-- | Construct a set containing all elements from a list of sets.
unions :: [UnorderedIntMap v] -> UnorderedIntMap v

-- | <i>O(n)</i> Transform this map by applying a function to every value.
map :: forall v1 v2. (v1 -> v2) -> UnorderedIntMap v1 -> UnorderedIntMap v2

-- | <i>O(n)</i> Transform this map by applying a function to every value.
mapWithKey :: Coercible key Int => (key -> v1 -> v2) -> UnorderedIntMap v1 -> UnorderedIntMap v2

-- | <i>O(n)</i> Transform this map by accumulating an Applicative result
--   from every value.
traverseWithKey :: (Coercible key Int, Applicative f) => (key -> v1 -> f v2) -> UnorderedIntMap v1 -> f (UnorderedIntMap v2)

-- | <i>O(n*log m)</i> Difference of two maps. Return elements of the first
--   map not existing in the second.
difference :: UnorderedIntMap v -> UnorderedIntMap w -> UnorderedIntMap v

-- | <i>O(n*log m)</i> Difference with a combining function. When two equal
--   keys are encountered, the combining function is applied to the values
--   of these keys. If it returns <a>Nothing</a>, the element is discarded
--   (proper set difference). If it returns (<tt><a>Just</a> y</tt>), the
--   element is updated with a new value <tt>y</tt>.
differenceWith :: (v -> w -> Maybe v) -> UnorderedIntMap v -> UnorderedIntMap w -> UnorderedIntMap v

-- | <i>O(n*log m)</i> Intersection of two maps. Return elements of the
--   first map for keys existing in the second.
intersection :: UnorderedIntMap v -> UnorderedIntMap w -> UnorderedIntMap v

-- | <i>O(n+m)</i> Intersection of two maps. If a key occurs in both maps
--   the provided function is used to combine the values from the two maps.
intersectionWith :: (v1 -> v2 -> v3) -> UnorderedIntMap v1 -> UnorderedIntMap v2 -> UnorderedIntMap v3

-- | <i>O(n+m)</i> Intersection of two maps. If a key occurs in both maps
--   the provided function is used to combine the values from the two maps.
intersectionWithKey :: Coercible key Int => (key -> v1 -> v2 -> v3) -> UnorderedIntMap v1 -> UnorderedIntMap v2 -> UnorderedIntMap v3

-- | <i>O(n)</i> Reduce this map by applying a binary operator to all
--   elements, using the given starting value (typically the left-identity
--   of the operator). Each application of the operator is evaluated before
--   before using the result in the next application. This function is
--   strict in the starting value.
foldl' :: (a -> v -> a) -> a -> UnorderedIntMap v -> a

-- | <i>O(n)</i> Reduce this map by applying a binary operator to all
--   elements, using the given starting value (typically the left-identity
--   of the operator). Each application of the operator is evaluated before
--   before using the result in the next application. This function is
--   strict in the starting value.
foldlWithKey' :: (a -> Int -> v -> a) -> a -> UnorderedIntMap v -> a

-- | <i>O(n)</i> Reduce this map by applying a binary operator to all
--   elements, using the given starting value (typically the right-identity
--   of the operator).
foldr :: (v -> a -> a) -> a -> UnorderedIntMap v -> a

-- | <i>O(n)</i> Reduce this map by applying a binary operator to all
--   elements, using the given starting value (typically the right-identity
--   of the operator).
foldrWithKey :: (Int -> v -> a -> a) -> a -> UnorderedIntMap v -> a

-- | <i>O(n)</i> Transform this map by applying a function to every value
--   and retaining only some of them.
mapMaybe :: (v1 -> Maybe v2) -> UnorderedIntMap v1 -> UnorderedIntMap v2

-- | <i>O(n)</i> Transform this map by applying a function to every value
--   and retaining only some of them.
mapMaybeWithKey :: (Int -> v1 -> Maybe v2) -> UnorderedIntMap v1 -> UnorderedIntMap v2

-- | <i>O(n)</i> Filter this map by retaining only elements which values
--   satisfy a predicate.
filter :: (v -> Bool) -> UnorderedIntMap v -> UnorderedIntMap v

-- | <i>O(n)</i> Filter this map by retaining only elements satisfying a
--   predicate.
filterWithKey :: forall v. (Int -> v -> Bool) -> UnorderedIntMap v -> UnorderedIntMap v

-- | <i>O(n)</i> Return a list of this map's keys. The list is produced
--   lazily.
keys :: UnorderedIntMap v -> [Int]

-- | <i>O(n)</i> Return a list of this map's values. The list is produced
--   lazily.
elems :: forall v. UnorderedIntMap v -> [v]

-- | <i>O(n)</i> Return a list of this map's elements. The list is produced
--   lazily. The order of its elements is unspecified.
toList :: UnorderedIntMap v -> [(Int, v)]

-- | <i>O(n)</i> Construct a map with the supplied mappings. If the list
--   contains duplicate mappings, the later mappings take precedence.
fromList :: [(Int, v)] -> UnorderedIntMap v

-- | <i>O(n*log n)</i> Construct a map from a list of elements. Uses the
--   provided function to merge duplicate entries.
fromListWith :: Coercible key Int => (v -> v -> v) -> [(key, v)] -> UnorderedIntMap v
type Bitmap = Word

-- | Create a <a>BitmapIndexed</a> or <a>Full</a> node.
bitmapIndexedOrFull :: Bitmap -> SmallArray (UnorderedIntMap v) -> UnorderedIntMap v
mask :: Int -> Shift -> Bitmap

-- | Mask out the <a>bitsPerSubkey</a> bits used for indexing at this level
--   of the tree.
index :: Int -> Shift -> Int
bitsPerSubkey :: Int

-- | A bitmask with the <a>bitsPerSubkey</a> least significant bits set.
fullNodeMask :: Bitmap
sparseIndex :: Bitmap -> Bitmap -> Int

-- | Create a map from two key-value pairs which hashes don't collide.
two :: Shift -> Int -> v -> Int -> v -> ST s (UnorderedIntMap v)

-- | Strict in the result of <tt>f</tt>.
unionArrayBy :: (a -> a -> a) -> Bitmap -> Bitmap -> SmallArray a -> SmallArray a -> SmallArray a

-- | <i>O(n)</i> Update the element at the given position in this array.
update16 :: SmallArray e -> Int -> e -> SmallArray e

-- | <i>O(n)</i> Update the element at the given position in this array.
update16M :: SmallArray e -> Int -> e -> ST s (SmallArray e)

-- | <i>O(n)</i> Update the element at the given position in this array, by
--   applying a function to it.
update16With' :: SmallArray e -> Int -> (e -> e) -> SmallArray e
updateOrConcatWith :: forall v. (v -> v -> v) -> SmallArray (Leaf v) -> SmallArray (Leaf v) -> SmallArray (Leaf v)
updateOrConcatWithKey :: (Int -> v -> v -> v) -> SmallArray (Leaf v) -> SmallArray (Leaf v) -> SmallArray (Leaf v)

-- | Common implementation for <a>filterWithKey</a> and
--   <a>mapMaybeWithKey</a>, allowing the former to former to reuse terms.
filterMapAux :: forall v1 v2. (UnorderedIntMap v1 -> Maybe (UnorderedIntMap v2)) -> UnorderedIntMap v1 -> UnorderedIntMap v2
equalKeys :: (Int -> Int -> Bool) -> UnorderedIntMap v -> UnorderedIntMap v' -> Bool
instance GHC.Classes.Eq v => GHC.Classes.Eq (Data.Unordered.IntMap.Leaf v)
instance Control.DeepSeq.NFData v => Control.DeepSeq.NFData (Data.Unordered.IntMap.UnorderedIntMap v)
instance GHC.Base.Functor Data.Unordered.IntMap.UnorderedIntMap
instance Data.Foldable.Foldable Data.Unordered.IntMap.UnorderedIntMap
instance Data.Semigroup.Semigroup (Data.Unordered.IntMap.UnorderedIntMap v)
instance GHC.Base.Monoid (Data.Unordered.IntMap.UnorderedIntMap v)
instance Data.Functor.Classes.Show1 Data.Unordered.IntMap.UnorderedIntMap
instance Data.Functor.Classes.Read1 Data.Unordered.IntMap.UnorderedIntMap
instance GHC.Read.Read e => GHC.Read.Read (Data.Unordered.IntMap.UnorderedIntMap e)
instance GHC.Show.Show v => GHC.Show.Show (Data.Unordered.IntMap.UnorderedIntMap v)
instance Data.Traversable.Traversable Data.Unordered.IntMap.UnorderedIntMap
instance Data.Functor.Classes.Eq1 Data.Unordered.IntMap.UnorderedIntMap
instance GHC.Classes.Eq v => GHC.Classes.Eq (Data.Unordered.IntMap.UnorderedIntMap v)
instance Data.Functor.Classes.Ord1 Data.Unordered.IntMap.UnorderedIntMap
instance GHC.Classes.Ord v => GHC.Classes.Ord (Data.Unordered.IntMap.UnorderedIntMap v)
instance GHC.Exts.IsList (Data.Unordered.IntMap.UnorderedIntMap v)
instance Control.DeepSeq.NFData v => Control.DeepSeq.NFData (Data.Unordered.IntMap.Leaf v)
