| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
NumHask.Range
- newtype Range a = Range {
- range_ :: (a, a)
- (...) :: Ord a => a -> a -> Range a
- posit :: Ord a => Range a -> Range a
- low :: Lens' (Range a) a
- high :: Lens' (Range a) a
- mid :: BoundedField a => Lens' (Range a) a
- width :: BoundedField a => Lens' (Range a) a
- element :: Ord a => a -> Range a -> Bool
- singleton :: a -> Range a
- singular :: Eq a => Range a -> Bool
- mirrored :: Ord a => Range a -> Bool
- intersection :: Ord a => Range a -> Range a -> Range a
- contains :: Ord a => Range a -> Range a -> Bool
- range :: (Foldable f, Ord a, BoundedField a) => f a -> Range a
- rescaleP :: Field b => Range b -> Range b -> b -> b
- data TickPos
- ticks :: (Field a, FromInteger a) => TickPos -> Range a -> Int -> [a]
- ticksSensible :: (Fractional a, Ord a, FromInteger a, QuotientField a, ExpRing a, MultiplicativeGroup a) => TickPos -> Range a -> Int -> [a]
- fromTicks :: [a] -> [Range a]
Documentation
a range represented by a (minimum, maximum) tuple very similar to https://hackage.haskell.org/package/intervals-0.7.2 but the metaphor and purpose there is closer to a fuzzy value around a central point.
Instances
mirrored :: Ord a => Range a -> Bool Source #
is the range low higher than the high there well may be an interesting complex-like set of operations on mirrored ranges
rescaleP :: Field b => Range b -> Range b -> b -> b Source #
`rescaleP rold rnew p` rescales a data point from an old range to a new range rescaleP o n (view low o) == view low n rescaleP o n (view high o) == view high n rescaleP a a == id
where on the Range should the ticks be placed
ticks :: (Field a, FromInteger a) => TickPos -> Range a -> Int -> [a] Source #
turn a range into a ist of n as, that are (view width x/n) apart
ticksSensible :: (Fractional a, Ord a, FromInteger a, QuotientField a, ExpRing a, MultiplicativeGroup a) => TickPos -> Range a -> Int -> [a] Source #
turn a range into n as pleasing to human sense and sensibility
the as may well lie outside the original range as a result