Copyright | (c) Christoph Breitkopf 2011 |
---|---|

License | BSD-style |

Maintainer | chbreitkopf@gmail.com |

Stability | experimental |

Portability | portable |

Safe Haskell | Safe |

Language | Haskell98 |

An implementation of maps from intervals to values. The key intervals may overlap, and the implementation contains efficient search functions for all keys containing a point or overlapping an interval. Closed, open, and half-open intervals can be contained in the same map.

This module re-exports the value lazy Data.IntervalMap.Lazy API, plus several value strict functions from Data.IntervalMap.Strict.

- module Data.IntervalMap.Lazy
- insertWith' :: Ord k => (a -> a -> a) -> Interval k -> a -> IntervalMap k a -> IntervalMap k a
- insertWithKey' :: Ord k => (Interval k -> a -> a -> a) -> Interval k -> a -> IntervalMap k a -> IntervalMap k a
- insertLookupWithKey' :: Ord k => (Interval k -> a -> a -> a) -> Interval k -> a -> IntervalMap k a -> (Maybe a, IntervalMap k a)
- fold :: (a -> b -> b) -> b -> IntervalMap k a -> b
- foldWithKey :: (Interval k -> a -> b -> b) -> b -> IntervalMap k a -> b

# Documentation

module Data.IntervalMap.Lazy

insertWith' :: Ord k => (a -> a -> a) -> Interval k -> a -> IntervalMap k a -> IntervalMap k a Source #

*Deprecated.* As of version 0.3, replaced by `insertWith`

.

*O(log n)*. Same as `insertWith`

, but the combining function is
applied strictly. This is often the most desirable behavior.

For example, to update a counter:

insertWith' (+) k 1 m

insertWithKey' :: Ord k => (Interval k -> a -> a -> a) -> Interval k -> a -> IntervalMap k a -> IntervalMap k a Source #

*Deprecated.* As of version 0.3, replaced by `insertWithKey`

.

*O(log n)*. Same as `insertWithKey`

, but the combining function is
applied strictly.

insertLookupWithKey' :: Ord k => (Interval k -> a -> a -> a) -> Interval k -> a -> IntervalMap k a -> (Maybe a, IntervalMap k a) Source #

*Deprecated.* As of version 0.3, replaced by
`insertLookupWithKey`

.

*O(log n)*. A strict version of `insertLookupWithKey`

.

fold :: (a -> b -> b) -> b -> IntervalMap k a -> b Source #

foldWithKey :: (Interval k -> a -> b -> b) -> b -> IntervalMap k a -> b Source #

*Deprecated.* As of version 0.3, replaced by `foldrWithKey`

.

*O(n)*. Fold the keys and values in the map using the given right-associative
binary operator. This function is an equivalent of `foldrWithKey`

and is present
for compatibility only.