Safe Haskell | None |
---|---|
Language | Haskell2010 |
This package is intended to be imported qualified, so many of the names of APIs provided will
conflict with the Data.Set module in the containers
package.
- data Inf c
- stepDown :: (Eq c, Enum c, InfBound c) => Inf c -> Inf c
- stepUp :: (Eq c, Enum c, InfBound c) => Inf c -> Inf c
- toFinite :: Inf c -> Maybe c
- enumIsInf :: Inf c -> Bool
- class InfBound c where
- minBoundInf :: Inf c
- maxBoundInf :: Inf c
- data Interval c
- startPoint :: Interval c -> Inf c
- endPoint :: Interval c -> Inf c
- toPair :: Interval c -> (Inf c, Inf c)
- fromPair :: (Eq c, Ord c) => Inf c -> Inf c -> Maybe (Interval c)
- interval :: (Ord c, InfBound c) => c -> c -> Interval c
- point :: Ord c => c -> Interval c
- wholeInterval :: Interval c
- negInfTo :: InfBound c => c -> Interval c
- toPosInf :: InfBound c => c -> Interval c
- toBounded :: Bounded c => Inf c -> c
- toBoundedPair :: Bounded c => Interval c -> (c, c)
- enumBoundedPair :: (Enum c, Bounded c) => Interval c -> [c]
- intervalMember :: (Eq c, Ord c) => Interval c -> c -> Bool
- singular :: Interval a -> Maybe (Inf a)
- plural :: Interval a -> Maybe (Inf a, Inf a)
- canonicalInterval :: (Eq c, Ord c, InfBound c) => Interval c -> [Interval c]
- intervalNub :: (Ord c, Enum c, InfBound c) => [Interval c] -> [Interval c]
- intervalInvert :: (Ord c, Enum c, InfBound c) => Interval c -> Set c
- intervalUnion :: (Ord c, Enum c, InfBound c) => Interval c -> Interval c -> Set c
- intervalIntersect :: (Ord c, Enum c, InfBound c) => Interval c -> Interval c -> Set c
- intervalDelete :: (Ord c, Enum c, InfBound c) => Interval c -> Interval c -> Set c
- intervalExclusion :: (Ord c, Enum c, InfBound c) => Interval c -> Interval c -> Set c
- areIntersecting :: (Eq c, Ord c) => Interval c -> Interval c -> Bool
- areConsecutive :: (Ord c, Enum c, InfBound c) => Interval c -> Interval c -> Bool
- class Ord i => SubBounded dat i where
- envelop :: (Ord c, InfBound c) => Interval c -> Interval c -> Interval c
- intervalSpanAll :: (Ord c, InfBound c) => [Interval c] -> Maybe (Interval c)
- intLength :: Integral c => Interval c -> Inf Integer
- enumLength :: (Ord c, Enum c, InfBound c) => Interval c -> Inf Integer
- intervalIntSize :: (Bounded c, Integral c) => Interval c -> Integer
- intervalEnumSize :: (Bounded c, Enum c) => Interval c -> Int
- isWithin :: (Eq c, Ord c) => Inf c -> Interval c -> Bool
- intervalHasEnumInf :: Interval c -> Bool
- intervalIsInfinite :: InfBound c => Interval c -> Bool
- data Set c
- empty :: Set c
- whole :: Set c
- fromList :: (Ord c, Enum c, InfBound c) => [Interval c] -> Set c
- fromPairs :: (Ord c, Enum c, InfBound c) => [(c, c)] -> Set c
- fromPoints :: (Ord c, Enum c, InfBound c) => [c] -> Set c
- range :: (Ord c, Enum c, InfBound c) => c -> c -> Set c
- singleton :: (Ord c, Enum c, InfBound c) => c -> Set c
- map :: (Eq b, Ord b, Enum b, InfBound b) => (a -> b) -> Set a -> Set b
- toList :: (Ord c, Enum c, InfBound c) => Set c -> [Interval c]
- intSize :: (Ord c, Integral c, InfBound c, Bounded c) => Set c -> Integer
- enumSize :: (Ord c, Enum c, Bounded c, InfBound c) => Set c -> Int
- cardinality :: (Ord c, Enum c, InfBound c) => Set c -> Inf Integer
- elems :: (Ord c, Enum c, Bounded c, InfBound c) => Set c -> [c]
- member :: (Ord c, InfBound c) => Set c -> c -> Bool
- null :: (Ord c, Enum c, InfBound c) => Set c -> Bool
- isWhole :: (Ord c, Enum c, InfBound c) => Set c -> Bool
- isSingleton :: (Ord c, Enum c, InfBound c) => Set c -> Maybe c
- invert :: (Ord c, Enum c, InfBound c) => Set c -> Set c
- exclusive :: (Ord c, Enum c, InfBound c) => Set c -> Set c -> Set c
- union :: (Ord c, Enum c, InfBound c) => Set c -> Set c -> Set c
- unions :: (Ord c, Enum c, InfBound c) => [Set c] -> Set c
- intersections :: (Ord c, Enum c, InfBound c) => [Set c] -> Set c
- intersect :: (Ord c, Enum c, InfBound c) => Set c -> Set c -> Set c
- delete :: (Ord c, Enum c, InfBound c) => Set c -> Set c -> Set c
- innerProduct :: (Ord c, Enum c, InfBound c) => (Interval c -> Interval c -> Set c) -> [Interval c] -> [Interval c] -> Set c
The Inf
data type
data Inf c
Enumerable elements with the possibility of infinity.
class InfBound c where
Like Bounded
, except the bounds might be infinite, and return NegInf
or
PosInf
for the bounds. Using the GHC "flexible instances" and "undecidable instances"
feature, any data type that is an instance of Bounded
is also a memberM of BoundInf
.
minBoundInf :: Inf c
maxBoundInf :: Inf c
the Interval
data type
data Interval c
startPoint :: Interval c -> Inf c
point :: Ord c => c -> Interval c
Construct a Interval
that is only a single unit, i.e. it starts at X and ends at X.
wholeInterval :: Interval c
Construct the infiniteM Interval
negInfTo :: InfBound c => c -> Interval c
Construct a Interval
from negative infinity to a given value.
toPosInf :: InfBound c => c -> Interval c
Construct a Interval
from a given value to positive infinity.
toBoundedPair :: Bounded c => Interval c -> (c, c)
Like toBounded
, but operates on a interval and returns a pair of values.
enumBoundedPair :: (Enum c, Bounded c) => Interval c -> [c]
intervalMember :: (Eq c, Ord c) => Interval c -> c -> Bool
Tests whether an element is a memberM is enclosed by the Interval
.
canonicalInterval :: (Eq c, Ord c, InfBound c) => Interval c -> [Interval c]
This gets rid of as many infiniteM elements as possible. All
and
Single
PosInf
points are eliminated, and if an Single
NegInf
NegInf
or PosInf
can be
replaced with a corresponding minBoundInf
or maxBoundInf
, then it is. This function is
intended to be used as a list monadic function, so use it like so:
let myListOfSegments = [...] in myListOfSegments >>=
delInfPoints
intervalNub :: (Ord c, Enum c, InfBound c) => [Interval c] -> [Interval c]
Eliminate overlapping and duplicate Interval
s from a list of segments.
intervalInvert :: (Ord c, Enum c, InfBound c) => Interval c -> Set c
Evaluates to the set of all elements not selected by the given Interval
.
intervalIntersect :: (Ord c, Enum c, InfBound c) => Interval c -> Interval c -> Set c
Performs a set intersection on two Interval
s of elements to create a new _interval. If the
elements of the new _interval are not contiguous, this function evaluates to an empty list.
intervalDelete :: (Ord c, Enum c, InfBound c) => Interval c -> Interval c -> Set c
Performs a set "delete" operation, deleteing any elements selected by the first _interval if
they are contained in the second _interval. This operation is not associative, i.e.
.intervalDelete
a b /= intervalDelete
b a
areIntersecting :: (Eq c, Ord c) => Interval c -> Interval c -> Bool
Returns true if two Interval
s are intersecting.
class Ord i => SubBounded dat i where
Describes a class of data types that contained a range of values described by an upper and
lower bound, a subset of the range of values of the minBoundInf
and maxBoundInf
. Unlike
Bounded
or InfBound
, this class describes data types like Array
s
which contain information about the upper and lower bound of the data type.
Ord i => SubBounded (Interval i) i | |
(Ord i, Ix i, InfBound i) => SubBounded (i, i) i | |
(Ord i, Ix i, InfBound i) => SubBounded (Array i o) i |
Predicates on Interval
s
envelop :: (Ord c, InfBound c) => Interval c -> Interval c -> Interval c
Construct the minimum Interval
that is big enough to hold both given segments.
intervalIntSize :: (Bounded c, Integral c) => Interval c -> Integer
intervalEnumSize :: (Bounded c, Enum c) => Interval c -> Int
intervalHasEnumInf :: Interval c -> Bool
A predicate evaluating whether or not a interval includes an PosInf
or NegInf
value.
This should not be confused with a predicate evaluating whether the set of elements included by
the rangeM is infiniteM, because types that are instances of Bounded
may also contain
PosInf
or NegInf
elements, values of these types may be evaluated as "infintie" by
this function, even though they are Bounded
. To check if a interval is infiniteM, use
intervalIsInfinite
instead.
intervalIsInfinite :: InfBound c => Interval c -> Bool
The Set
data type
data Set c
(Enum c, Ord c, InfBound c) => Eq (Set c) | |
(Enum c, Ord c, InfBound c) => Ord (Set c) | |
(Eq c, Ord c, Enum c, Read c, InfBound c) => Read (Set c) | |
(Eq c, Ord c, Enum c, Show c, InfBound c) => Show (Set c) | |
(Ord c, Enum c, InfBound c) => Monoid (Sum (Set c)) | |
(Ord c, Enum c, InfBound c) => Monoid (Product (Set c)) | |
NFData a => NFData (Set a) | |
Typeable (* -> *) Set |
fromPoints :: (Ord c, Enum c, InfBound c) => [c] -> Set c
cardinality :: (Ord c, Enum c, InfBound c) => Set c -> Inf Integer
Evaluate a possibly infinite Integer
value counting the number of elements in the
set.
Set Operators for non-monadic Set
s
Miscelaneous
innerProduct :: (Ord c, Enum c, InfBound c) => (Interval c -> Interval c -> Set c) -> [Interval c] -> [Interval c] -> Set c
This function takes a multiplication function, usually intervalIntersect
or intervalDelete
.
It works like polynomial multiplication, with the provided reduction function computing the
product of every pair of Interval
s, and then the "sum" (actually the intervalUnion
) of all
products are taken. The intersect
and exclusive
functions are defined to use this function.