fingertree-0.1.5.0: Generic finger-tree structure, with example instances
Copyright (c) Ross Paterson 2008
License BSD-style
Maintainer R.Paterson@city.ac.uk
Stability experimental
Portability non-portable (MPTCs and functional dependencies)
Safe Haskell Safe
Language Haskell2010

Data.IntervalMap.FingerTree

Description

Interval maps implemented using the FingerTree type, following section 4.8 of

An amortized running time is given for each operation, with n referring to the size of the priority queue. These bounds hold even in a persistent (shared) setting.

Note : Many of these operations have the same names as similar operations on lists in the Prelude . The ambiguity may be resolved using either qualification or the hiding clause.

Synopsis

Intervals

data Interval v Source #

A closed interval. The lower bound should be less than or equal to the upper bound.

Constructors

Interval v v

Lower and upper bounds of the interval.

Instances

Instances details
Eq v => Eq ( Interval v) Source #
Instance details

Defined in Data.IntervalMap.FingerTree

Ord v => Ord ( Interval v) Source #
Instance details

Defined in Data.IntervalMap.FingerTree

Read v => Read ( Interval v) Source #
Instance details

Defined in Data.IntervalMap.FingerTree

Show v => Show ( Interval v) Source #
Instance details

Defined in Data.IntervalMap.FingerTree

Generic ( Interval v) Source #
Instance details

Defined in Data.IntervalMap.FingerTree

Associated Types

type Rep ( Interval v) :: Type -> Type Source #

type Rep ( Interval v) Source #
Instance details

Defined in Data.IntervalMap.FingerTree

low :: Interval v -> v Source #

Lower bound of the interval

high :: Interval v -> v Source #

Upper bound of the interval

point :: v -> Interval v Source #

An interval in which the lower and upper bounds are equal.

Interval maps

data IntervalMap v a Source #

Map of closed intervals, possibly with duplicates.

Instances

Instances details
Functor ( IntervalMap v) Source #
Instance details

Defined in Data.IntervalMap.FingerTree

Foldable ( IntervalMap v) Source #

Values in lexicographical order of intervals.

Instance details

Defined in Data.IntervalMap.FingerTree

Traversable ( IntervalMap v) Source #

Traverse the intervals in lexicographical order.

Instance details

Defined in Data.IntervalMap.FingerTree

( Eq v, Eq a) => Eq ( IntervalMap v a) Source #
Instance details

Defined in Data.IntervalMap.FingerTree

( Ord v, Ord a) => Ord ( IntervalMap v a) Source #

Lexicographical ordering

Instance details

Defined in Data.IntervalMap.FingerTree

( Show v, Show a) => Show ( IntervalMap v a) Source #
Instance details

Defined in Data.IntervalMap.FingerTree

Generic ( IntervalMap v a) Source #
Instance details

Defined in Data.IntervalMap.FingerTree

Associated Types

type Rep ( IntervalMap v a) :: Type -> Type Source #

Ord v => Semigroup ( IntervalMap v a) Source #

union .

Instance details

Defined in Data.IntervalMap.FingerTree

Ord v => Monoid ( IntervalMap v a) Source #

empty and union .

Instance details

Defined in Data.IntervalMap.FingerTree

type Rep ( IntervalMap v a) Source #
Instance details

Defined in Data.IntervalMap.FingerTree

empty :: Ord v => IntervalMap v a Source #

O(1) . The empty interval map.

singleton :: Ord v => Interval v -> a -> IntervalMap v a Source #

O(1) . Interval map with a single entry.

insert :: Ord v => Interval v -> a -> IntervalMap v a -> IntervalMap v a Source #

O(log n) . Insert an interval and associated value into a map. The map may contain duplicate intervals; the new entry will be inserted before any existing entries for the same interval.

union :: Ord v => IntervalMap v a -> IntervalMap v a -> IntervalMap v a Source #

O(m log (n / m)) . Merge two interval maps. The map may contain duplicate intervals; entries with equal intervals are kept in the original order.

Searching

search :: Ord v => v -> IntervalMap v a -> [( Interval v, a)] Source #

O(k log (n / k)) . All intervals that contain the given point, in lexicographical order.

intersections :: Ord v => Interval v -> IntervalMap v a -> [( Interval v, a)] Source #

O(k log (n / k)) . All intervals that intersect with the given interval, in lexicographical order.

dominators :: Ord v => Interval v -> IntervalMap v a -> [( Interval v, a)] Source #

O(k log (n / k)) . All intervals that contain the given interval, in lexicographical order.

Extraction

bounds :: Ord v => IntervalMap v a -> Maybe ( Interval v) Source #

O(1) . bounds m returns Nothing if m is empty, and otherwise Just i , where i is the smallest interval containing all the intervals in the map.

Since: 0.1.3.0

leastView :: Ord v => IntervalMap v a -> Maybe (( Interval v, a), IntervalMap v a) Source #

O(1) . leastView m returns Nothing if m is empty, and otherwise Just ((i, x), m') , where i is the least interval, x is the associated value, and m' is the rest of the map.

Since: 0.1.3.0

splitAfter :: Ord v => v -> IntervalMap v a -> ( IntervalMap v a, IntervalMap v a) Source #

O(log(min(i,n-i))) . splitAfter k m returns a pair of submaps, one consisting of intervals whose lower bound is less than or equal to k , and the other of those whose lower bound is greater.

Since: 0.1.3.0