-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Please see the README on Github at
-- https://github.com/andrewthad/vicinity#readme
@package vicinity
@version 0.1.0
module Data.Vicinities
module Data.Vicinity
-- | A map-like container optimized for the execution of range queries. The
-- key must have an Ord instance and the value must have
-- Monoid instance whose append operation is also commutative.
data Vicinity k v
-- | Get the monoidal concatenation of all values in the range. The bounds
-- are both inclusive. Either bound can be omitted.
query :: (Ord k, Monoid v) => Maybe k -> Maybe k -> Vicinity k v -> v
-- | O(1). The monoidal concatenation of all values in the map. This is
-- equivalent to query Nothing Nothing.
total :: Monoid v => Vicinity k v -> v
lookup :: (Ord k, Monoid v) => k -> Vicinity k v -> v
-- | Split the map at the target key. The map that is the first element of
-- the tuple has keys lower than the target. The map that is the third
-- element of the tuple has keys higher than the target. The second
-- element of the tuple is the value at the key if the key was found.
splitLookup :: (Ord k, Monoid v) => k -> Vicinity k v -> (Vicinity k v, Maybe v, Vicinity k v)
-- | Create a map with a single key-value pair.
singleton :: k -> v -> Vicinity k v
-- | Insert a key associated with a value into the map. If the key already
-- exists, the existing value and the new value are combined using the
-- Monoid instance for v. The implementation of
-- mappend is expected to be commutative, so the order in which
-- the old and new values are combined is not specified.
insert :: (Ord k, Monoid v) => k -> v -> Vicinity k v -> Vicinity k v
-- | Combine two maps. If the same key exists in both maps, the values
-- associated with it are combined using the Monoid instance for
-- v. Note that the Monoid instance of Vicinity
-- defines mappend as union.
union :: (Ord k, Monoid v) => Vicinity k v -> Vicinity k v -> Vicinity k v
-- | Build a map from a list of key-value pairs.
fromList :: (Ord k, Monoid v) => [(k, v)] -> Vicinity k v
-- | Fold over the keys in the map along with their values.
foldrWithKey :: (k -> v -> a -> a) -> a -> Vicinity k v -> a
-- | Get the keys of the map.
keys :: Vicinity k v -> [k]
-- | Convert the map to a list of key-value pairs.
toList :: Vicinity k v -> [(k, v)]
-- | Combine two vicinities. All keys is the first one must be less than
-- all keys in the second one.
uncheckedConcat :: Monoid v => Vicinity k v -> Vicinity k v -> Vicinity k v
instance (GHC.Show.Show v, GHC.Show.Show k) => GHC.Show.Show (Data.Vicinity.N n k v)
instance (GHC.Show.Show k, GHC.Show.Show v) => GHC.Show.Show (Data.Vicinity.Vicinity k v)
instance (GHC.Classes.Eq k, GHC.Classes.Eq v) => GHC.Classes.Eq (Data.Vicinity.Vicinity k v)
instance (GHC.Classes.Ord k, GHC.Classes.Ord v) => GHC.Classes.Ord (Data.Vicinity.Vicinity k v)
instance (GHC.Classes.Ord k, GHC.Base.Monoid v) => Data.Semigroup.Semigroup (Data.Vicinity.Vicinity k v)
instance (GHC.Classes.Ord k, GHC.Base.Monoid v) => GHC.Base.Monoid (Data.Vicinity.Vicinity k v)
instance Data.Foldable.Foldable (Data.Vicinity.Vicinity k)
instance (GHC.Show.Show k, GHC.Show.Show v) => GHC.Show.Show (Data.Vicinity.Tree k v)
instance Data.Foldable.Foldable (Data.Vicinity.Tree k)
instance (GHC.Show.Show k, GHC.Show.Show v) => GHC.Show.Show (Data.Vicinity.T n k v)