primitive-containers-0.4.1: containers backed by arrays

Data.Map.Interval.DBTSUL

Synopsis

# Documentation

data Map k v Source #

A total interval map from keys k to values v. The key type must be discrete and bounded. This map is strict in the values. The key type must have a Prim instance.

Instances
 (Prim k, Bounded k, Enum k, Ord k, Eq v, Monoid v) => IsList (Map k v) Source # Instance detailsDefined in Data.Map.Interval.DBTSUL Associated Typestype Item (Map k v) :: Type # MethodsfromList :: [Item (Map k v)] -> Map k v #fromListN :: Int -> [Item (Map k v)] -> Map k v #toList :: Map k v -> [Item (Map k v)] # (Prim k, Eq k, Eq v) => Eq (Map k v) Source # Instance detailsDefined in Data.Map.Interval.DBTSUL Methods(==) :: Map k v -> Map k v -> Bool #(/=) :: Map k v -> Map k v -> Bool # (Prim k, Bounded k, Enum k, Show k, Show v) => Show (Map k v) Source # Instance detailsDefined in Data.Map.Interval.DBTSUL MethodsshowsPrec :: Int -> Map k v -> ShowS #show :: Map k v -> String #showList :: [Map k v] -> ShowS # (Prim k, Ord k, Semigroup v, Eq v) => Semigroup (Map k v) Source # Instance detailsDefined in Data.Map.Interval.DBTSUL Methods(<>) :: Map k v -> Map k v -> Map k v #sconcat :: NonEmpty (Map k v) -> Map k v #stimes :: Integral b => b -> Map k v -> Map k v # (Prim k, Ord k, Bounded k, Semigroup v, Monoid v, Eq v) => Monoid (Map k v) Source # Instance detailsDefined in Data.Map.Interval.DBTSUL Methodsmempty :: Map k v #mappend :: Map k v -> Map k v -> Map k v #mconcat :: [Map k v] -> Map k v # type Item (Map k v) Source # Instance detailsDefined in Data.Map.Interval.DBTSUL type Item (Map k v) = (k, k, v)

pure :: (Prim k, Bounded k) => v -> Map k v Source #

Arguments

 :: (Prim k, Bounded k, Enum k, Ord k, Eq v) => v value outside of the interval -> k lower bound -> k upper bound -> v value inside the interval -> Map k v

lookup :: (Ord k, Prim k) => k -> Map k v -> v Source #

O(log n) Lookup a key. The value corresponding to the range that contains this key will be returned.

Arguments

 :: (Prim k, Bounded k, Ord k, Enum k, Eq v) => v value outside of the ranges -> [(k, k, v)] low-high inclusive ranges with their corresponding values -> Map k v

Create an interval map from a list of range-value triples. The first argument is a default value used everywhere outside of the given ranges. In the case of overlapping ranges, the leftmost value is used.

unionWith :: (Ord k, Eq c, Prim k) => (a -> b -> c) -> Map k a -> Map k b -> Map k c Source #

# Mapping

map :: (Prim k, Eq w) => (v -> w) -> Map k v -> Map k w Source #

mapBijection :: (v -> w) -> Map k v -> Map k w Source #

# Traversals

traverseBijectionP :: PrimMonad m => (v -> m w) -> Map k v -> m (Map k w) Source #

This only provides a correct result when the effectful mapping is a bijection.

traverseBijection :: Applicative m => (v -> m w) -> Map k v -> m (Map k w) Source #

This only provides a correct result when the effectful mapping is a bijection.

# Folds

foldl' :: Prim k => (b -> v -> b) -> b -> Map k v -> b Source #

foldlM' :: (Monad m, Prim k) => (b -> v -> m b) -> b -> Map k v -> m b Source #

foldMap :: (Monoid m, Prim k) => (v -> m) -> Map k v -> m Source #

foldrWithKey :: (Bounded k, Enum k, Prim k) => (k -> k -> v -> b -> b) -> b -> Map k v -> b Source #

foldlWithKeyM' :: (Bounded k, Enum k, Monad m, Prim k) => (b -> k -> k -> v -> m b) -> b -> Map k v -> m b Source #

traverse_ :: Applicative m => (v -> m w) -> Map k v -> m () Source #

# Properties

size :: Map k v -> Int Source #

The number of values in the interval map. Also the number of contiguous key ranges in the map.

# Conversion

elems :: Map k v -> Array v Source #

toList :: (Bounded k, Enum k, Prim k) => Map k v -> [(k, k, v)] Source #

fromLiftedLifted :: Prim k => Map k v -> Map k v Source #