Closed ncfavier closed 11 months ago
Shall we make it total, returning Maybe Integer
?
In that case we might as well return Extended Integer
, so that the memberCount
of an unbounded interval is PosInf
?
Imagine yourself on the consuming end, where you have to pattern match on the output of memberCount
. What would you do for NegInf
? Throw error "this should never happen"
? I'd prefer to receive Maybe
.
Thanks!
Thanks! A release including this change (and my last one from last year) would be appreciated.
Returns the number of integers that lie within an integer interval.
This is different from the
width
and cannot simply be computed as(+ 1) . width
because of the null interval.Addresses https://github.com/msakai/data-interval/issues/39
EDIT: I initially named this
magnitude
because I misunderstood whatNumeric.Interval.magnitude
does. Feel free to suggest a better name.