packages feed

IntervalMap-0.6.2.4 / Data / IntervalMap.hs

{- |Module      :  Data.IntervalMapCopyright   :  (c) Christoph Breitkopf 2011License     :  BSD-styleMaintainer  :  chbreitkopf@gmail.comStability   :  experimentalPortability :  portableAn implementation of maps from intervals to values. The key intervals mayoverlap, and the implementation contains efficient search functionsfor 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, plusseveral value strict functions from "Data.IntervalMap.Strict".-}module Data.IntervalMap    ( module Data.IntervalMap.Lazy    , insertWith'    , insertWithKey'    , insertLookupWithKey'    , fold    , foldWithKey    ) whereimport Data.IntervalMap.Lazyimport qualified Data.IntervalMap.Lazy as Limport qualified Data.IntervalMap.Strict as S-- | /Deprecated./ As of version 0.3, replaced by 'S.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--insertWith' :: Ord k => (a -> a -> a) -> Interval k -> a -> IntervalMap k a -> IntervalMap k ainsertWith' = S.insertWith{-# INLINABLE insertWith' #-}-- | /Deprecated./ As of version 0.3, replaced by 'S.insertWithKey'.---- /O(log n)/. Same as 'insertWithKey', but the combining function is-- applied strictly.insertWithKey' :: Ord k => (Interval k -> a -> a -> a) -> Interval k -> a -> IntervalMap k a -> IntervalMap k ainsertWithKey' = S.insertWithKey{-# INLINABLE insertWithKey' #-}-- | /Deprecated./ As of version 0.3, replaced by-- 'S.insertLookupWithKey'.---- /O(log n)/. A strict version of 'insertLookupWithKey'.insertLookupWithKey' :: Ord k => (Interval k -> a -> a -> a) -> Interval k -> a -> IntervalMap k a                     -> (Maybe a, IntervalMap k a)insertLookupWithKey' = S.insertLookupWithKey-- | /Deprecated./ As of version 0.5, replaced by 'L.foldr'.---- /O(n)/. Fold the values in the map using the given right-associative-- binary operator. This function is an equivalent of 'foldr' and is present-- for compatibility only.fold :: (a -> b -> b) -> b -> IntervalMap k a -> bfold = L.foldr-- | /Deprecated./ As of version 0.3, replaced by 'L.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.foldWithKey :: (Interval k -> a -> b -> b) -> b -> IntervalMap k a -> bfoldWithKey = foldrWithKey