alex
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Ranged.RangedSet

Synopsis

Ranged Set Type

data DiscreteOrdered v => RSet v Source #

An RSet (for Ranged Set) is a list of ranges. The ranges must be sorted and not overlap.

Instances

Instances details
DiscreteOrdered a => Monoid (RSet a) Source # 
Instance details

Defined in Data.Ranged.RangedSet

Methods

mempty :: RSet a #

mappend :: RSet a -> RSet a -> RSet a #

mconcat :: [RSet a] -> RSet a #

DiscreteOrdered a => Semigroup (RSet a) Source # 
Instance details

Defined in Data.Ranged.RangedSet

Methods

(<>) :: RSet a -> RSet a -> RSet a #

sconcat :: NonEmpty (RSet a) -> RSet a #

stimes :: Integral b => b -> RSet a -> RSet a #

(DiscreteOrdered v, Show v) => Show (RSet v) Source # 
Instance details

Defined in Data.Ranged.RangedSet

Methods

showsPrec :: Int -> RSet v -> ShowS #

show :: RSet v -> String #

showList :: [RSet v] -> ShowS #

DiscreteOrdered v => Eq (RSet v) Source # 
Instance details

Defined in Data.Ranged.RangedSet

Methods

(==) :: RSet v -> RSet v -> Bool #

(/=) :: RSet v -> RSet v -> Bool #

DiscreteOrdered v => Ord (RSet v) Source # 
Instance details

Defined in Data.Ranged.RangedSet

Methods

compare :: RSet v -> RSet v -> Ordering #

(<) :: RSet v -> RSet v -> Bool #

(<=) :: RSet v -> RSet v -> Bool #

(>) :: RSet v -> RSet v -> Bool #

(>=) :: RSet v -> RSet v -> Bool #

max :: RSet v -> RSet v -> RSet v #

min :: RSet v -> RSet v -> RSet v #

Ranged Set construction functions and their preconditions

makeRangedSet :: DiscreteOrdered v => [Range v] -> RSet v Source #

Create a new Ranged Set from a list of ranges. The list may contain ranges that overlap or are not in ascending order.

unsafeRangedSet :: DiscreteOrdered v => [Range v] -> RSet v Source #

Create a new Ranged Set from a list of ranges. validRangeList ranges must return True. This precondition is not checked.

validRangeList :: DiscreteOrdered v => [Range v] -> Bool Source #

Determine if the ranges in the list are both in order and non-overlapping. If so then they are suitable input for the unsafeRangedSet function.

normaliseRangeList :: DiscreteOrdered v => [Range v] -> [Range v] Source #

Rearrange and merge the ranges in the list so that they are in order and non-overlapping.

rSingleton :: DiscreteOrdered v => v -> RSet v Source #

Create a Ranged Set from a single element.

rSetUnfold Source #

Arguments

:: DiscreteOrdered a 
=> Boundary a

A first lower boundary.

-> (Boundary a -> Boundary a)

A function from a lower boundary to an upper boundary, which must return a result greater than the argument (not checked).

-> (Boundary a -> Maybe (Boundary a))

A function from a lower boundary to Maybe the successor lower boundary, which must return a result greater than the argument (not checked). If ranges overlap then they will be merged.

-> RSet a 

Construct a range set.

Predicates

rSetIsEmpty :: DiscreteOrdered v => RSet v -> Bool Source #

True if the set has no members.

rSetIsFull :: DiscreteOrdered v => RSet v -> Bool Source #

True if the negation of the set has no members.

(-?-) :: DiscreteOrdered v => RSet v -> v -> Bool infixl 5 Source #

True if the value is within the ranged set. Infix precedence is left 5.

rSetHas :: DiscreteOrdered v => RSet v -> v -> Bool Source #

True if the value is within the ranged set. Infix precedence is left 5.

(-<=-) :: DiscreteOrdered v => RSet v -> RSet v -> Bool infixl 5 Source #

True if the first argument is a subset of the second argument, or is equal.

Infix precedence is left 5.

rSetIsSubset :: DiscreteOrdered v => RSet v -> RSet v -> Bool Source #

True if the first argument is a subset of the second argument, or is equal.

Infix precedence is left 5.

(-<-) :: DiscreteOrdered v => RSet v -> RSet v -> Bool infixl 5 Source #

True if the first argument is a strict subset of the second argument.

Infix precedence is left 5.

rSetIsSubsetStrict :: DiscreteOrdered v => RSet v -> RSet v -> Bool Source #

True if the first argument is a strict subset of the second argument.

Infix precedence is left 5.

Set Operations

(-\/-) :: DiscreteOrdered v => RSet v -> RSet v -> RSet v infixl 6 Source #

Set union for ranged sets. Infix precedence is left 6.

rSetUnion :: DiscreteOrdered v => RSet v -> RSet v -> RSet v Source #

Set union for ranged sets. Infix precedence is left 6.

(-/\-) :: DiscreteOrdered v => RSet v -> RSet v -> RSet v infixl 7 Source #

Set intersection for ranged sets. Infix precedence is left 7.

rSetIntersection :: DiscreteOrdered v => RSet v -> RSet v -> RSet v Source #

Set intersection for ranged sets. Infix precedence is left 7.

(-!-) :: DiscreteOrdered v => RSet v -> RSet v -> RSet v infixl 6 Source #

Set difference. Infix precedence is left 6.

rSetDifference :: DiscreteOrdered v => RSet v -> RSet v -> RSet v Source #

Set difference. Infix precedence is left 6.

rSetNegation :: DiscreteOrdered a => RSet a -> RSet a Source #

Set negation.

Useful Sets

rSetEmpty :: DiscreteOrdered a => RSet a Source #

The empty set.

rSetFull :: DiscreteOrdered a => RSet a Source #

The set that contains everything.