-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Container with element counts
--
-- Container with element counts
@package refcount
@version 0.1.2
module Data.Refcount
-- | Maintain a collection of objects with duplication counts.
newtype Refcount a
Refcount :: HashMap a Int -> Refcount a
unRefcount :: Refcount a -> HashMap a Int
-- | Lookup the count of an object.
refcount :: (Hashable a, Eq a) => a -> Refcount a -> Int
-- | Retrieve objects and their counts.
refcounts :: Refcount a -> [(a, Int)]
-- | Retrieve the refcounted objects.
refcounted :: Refcount a -> [a]
-- | Insert an object and increment its count.
insertRef :: (Hashable a, Eq a) => a -> Refcount a -> Refcount a
-- | Remove a reference to an element and decrease its count, possibly
-- removing it from the set. Returns Nothing if the element
-- wasn't found, or Just set.
deleteRef :: (Hashable a, Eq a) => a -> Refcount a -> Maybe (Refcount a)
-- | Remove a reference to an element and decrease its count, possibly
-- removing it from the set. Returns Nothing if the element
-- wasn't found, or Just (wasRemoved, set).
removeRef :: (Hashable a, Eq a) => a -> Refcount a -> Maybe (Bool, Refcount a)
-- | Create a counted structure from a list of elements.
fromList :: (Hashable a, Eq a) => [a] -> Refcount a
instance Show a => Show (Refcount a)
instance Generic (Refcount a)
instance Eq a => Eq (Refcount a)
instance Datatype D1Refcount
instance Constructor C1_0Refcount
instance Selector S1_0_0Refcount
instance (Arbitrary a, Hashable a, Eq a) => Arbitrary (Refcount a)
instance (Hashable a, Eq a) => Monoid (Refcount a)