Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
A Space containing numerical elements
Documentation
A continuous range over type a
>>>
let a = Range (-1) 1
>>>
a
Range -1 1
>>>
a + a
Range -2 2
>>>
a * a
Range -2.0 2.0
>>>
(+1) <$> (Range 1 2)
Range 2 3
Ranges are very useful in shifting a bunch of numbers from one Range to another. eg project 0.5 from the range 0 to 1 to the range 1 to 4
>>>
project (Range 0 1) (Range 1 4) 0.5
2.5
Create an equally spaced grid including outer bounds over a Range
>>>
grid OuterPos (Range 0.0 10.0) 5
[0.0,2.0,4.0,6.0,8.0,10.0]
divide up a Range into equal-sized sections
>>>
gridSpace (Range 0.0 1.0) 4
[Range 0.0 0.25,Range 0.25 0.5,Range 0.5 0.75,Range 0.75 1.0]
Range a a |