rset-1.0.0: Range set

Copyright(c) 2017 Daniel Lovasko
LicenseBSD2
MaintainerDaniel Lovasko <daniel.lovasko@gmail.com>
Stabilitystable
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

Data.Set.Range

Description

 

Synopsis

Documentation

type Range a = (a, a) Source #

A simple range, denoted by the low and high boundaries.

type RangeSet a = [Range a] Source #

A set of ranges

empty Source #

Arguments

:: RangeSet a

range set

Create an empty range set.

null Source #

Arguments

:: RangeSet a

range set

-> Bool

decision

Test if the range set does not contain any points.

size Source #

Arguments

:: (Num n, Enum a) 
=> RangeSet a

range set

-> n

number of points

Count the number of unique points stored in the range set.

fromAscList Source #

Arguments

:: (Ord a, Enum a) 
=> [a]

list of ascending points

-> RangeSet a

range set

Create a range set from a list of ascending points. The list can contain duplicates.

fromDescList Source #

Arguments

:: (Ord a, Enum a) 
=> [a]

list of ascending points

-> RangeSet a

range set

Create a range set from a list of descending points. The list can contain duplicates.

fromList Source #

Arguments

:: (Ord a, Enum a) 
=> [a]

list of points

-> RangeSet a

range set

Create a range set from a list of points. The ordering of the points is not important. The list can contain duplicates.

toList Source #

Arguments

:: Enum a 
=> RangeSet a

range set

-> [a]

points

Convert the range set into a list of points.

insertPoint Source #

Arguments

:: (Ord a, Enum a) 
=> a

point

-> RangeSet a

old range set

-> RangeSet a

new range set

Insert a single point into the range set.

insertRange Source #

Arguments

:: (Ord a, Enum a) 
=> (a, a)

range

-> RangeSet a

old range set

-> RangeSet a

new range set

Insert a range into the range set.

removePoint :: (Ord a, Enum a) => a -> RangeSet a -> RangeSet a Source #

Remove a single point from the range set.

removeRange :: (Ord a, Enum a) => (a, a) -> RangeSet a -> RangeSet a Source #

Remove a range from the range set.

queryPoint Source #

Arguments

:: Ord a 
=> a

point

-> RangeSet a

range

-> Bool

decision

Test whether a point is included in the range set.

queryRange Source #

Arguments

:: Ord a 
=> (a, a)

range

-> RangeSet a

range set

-> Bool

decision

Test whether a range is included in the range set.

difference Source #

Arguments

:: (Ord a, Enum a) 
=> RangeSet a

first range set

-> RangeSet a

second range set

-> RangeSet a

difference of two range sets

Subtract a range set from another range.

intersect Source #

Arguments

:: (Ord a, Enum a) 
=> RangeSet a

first range set

-> RangeSet a

second range set

-> RangeSet a

intersection of two range sets

Create an intersection of two range sets.

union Source #

Arguments

:: (Ord a, Enum a) 
=> RangeSet a

first range set

-> RangeSet a

second range set

-> RangeSet a

union of two range sets

Create an union of two range sets.