|
|
|
|
|
| Description |
| A range has an upper and lower boundary.
|
|
| Synopsis |
|
|
|
|
| Construction
|
|
|
| A Range has upper and lower boundaries.
| | Constructors | | Instances | |
|
|
|
| The empty range
|
|
|
| The full range. All values are within it.
|
|
| Predicates
|
|
|
| A range is empty unless its upper boundary is greater than its lower
boundary.
|
|
|
| Two ranges overlap if their intersection is non-empty.
|
|
|
| The first range encloses the second if every value in the second range is
also within the first range. If the second range is empty then this is
always true.
|
|
|
| If the range is a singleton, returns Just the value. Otherwise returns
Nothing.
|
|
| Membership
|
|
|
| True if the value is within the range.
|
|
|
| True if the value is within one of the ranges.
|
|
| Set Operations
|
|
|
| A range containing a single value
|
|
|
| Intersection of two ranges, if any.
|
|
|
Union of two ranges. Returns one or two results.
If there are two results then they are guaranteed to have a non-empty
gap in between, but may not be in ascending order.
|
|
|
| range1 minus range2. Returns zero, one or two results. Multiple
results are guaranteed to have non-empty gaps in between, but may not be in
ascending order.
|
|
| QuickCheck properties
|
|
Range union
prop_union r1 r2 n =
(r1 `rangeHas` n || r2 `rangeHas` n)
== (r1 `rangeUnion` r2) `rangeListHas` n
Range intersection
prop_intersection r1 r2 n =
(r1 `rangeHas` n && r2 `rangeHas` n)
== (r1 `rangeIntersection` r2) `rangeHas` n
Range difference
prop_difference r1 r2 n =
(r1 `rangeHas` n && not (r2 `rangeHas` n))
== (r1 `rangeDifference` r2) `rangeListHas` n
Singleton range
prop_singletonHas v =
singletonRange v `rangeHas` v
prop_singletonConverse v =
rangeSingletonValue (singletonRange v) == Just v
|
|
| Produced by Haddock version 2.1.0 |