Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- data Piecewise k v = Piecewise {}
- rightEnd :: Piecewise k v -> v
- fromAscList :: Eq v => v -> [(k, v)] -> Piecewise k v
- fromAscListUnsafe :: v -> [(k, v)] -> Piecewise k v
- changeAt :: v -> k -> v -> Piecewise k v
- greaterThanOrEqual :: k -> Piecewise k Bool
- lessThan :: k -> Piecewise k Bool
- greaterThan :: Enum k => k -> Piecewise k Bool
- lessThanOrEqual :: Enum k => k -> Piecewise k Bool
- values :: Piecewise k v -> [v]
- mapKeysMonotonic :: (k -> l) -> Piecewise k v -> Piecewise l v
- mapKeysAntitonic :: (k -> l) -> Piecewise k v -> Piecewise l v
- splitPiecewise :: Ord k => k -> Piecewise k v -> (Piecewise k v, Piecewise k v)
- gluePiecewise :: Eq v => Piecewise k v -> k -> Piecewise k v -> Piecewise k v
- mjoin :: (Ord k, Eq w) => (v -> Piecewise k w) -> Piecewise k v -> Piecewise k w
Documentation
A data structure storing mappings that are constant on intervals.
If the space of keys not discrete, then these mappings are right-continuous: values are in general defined on intervals $a leq x < b$ which are closed on the left and open on the right.
Instances
fromAscList :: Eq v => v -> [(k, v)] -> Piecewise k v Source #
Assumes the keys are distinct and increasing (but consecutive values may be the same, in which case the intervening keys are removed)
fromAscListUnsafe :: v -> [(k, v)] -> Piecewise k v Source #
Assumes that the keys are distinct and increasing, and also that consecutive values are distinct
greaterThanOrEqual :: k -> Piecewise k Bool Source #
Is the value greater than or equal to k
?
greaterThan :: Enum k => k -> Piecewise k Bool Source #
Is the value greater than k
? This is subject to the usual
concerns about Enum
(it not to be used with floating-point
arithmetic, for example)
lessThanOrEqual :: Enum k => k -> Piecewise k Bool Source #
Is the value less than or equal to k
? This is subject to the
usual concerns about Enum
(it not to be used with floating-point
arithmetic, for example)
mapKeysMonotonic :: (k -> l) -> Piecewise k v -> Piecewise l v Source #
Alter keys according to a function, assumed to be monotone (not checked)
mapKeysAntitonic :: (k -> l) -> Piecewise k v -> Piecewise l v Source #
Alter keys according to a function, assumed to be antitone (not checked)
splitPiecewise :: Ord k => k -> Piecewise k v -> (Piecewise k v, Piecewise k v) Source #
Split in two: one which assumes keys are less than k
, and one
which assumes them greater than or equal to k
.