Closed rtfeldman closed 2 years ago
Would Num.pi
and Num.e
/ Num.exp(...)
be of type Num.Frac
too? Because those technically aren't rational numbers – they can't be represented by a fraction. What about Num.Real
?
This makes sense to me from a domain modelling standpoint, since Real a
would be used when defining functions, so it makes sense that the one who is creating the function should be thinking about the set of numbers they intend to support.
All of those constants are fractional approximations; Num.pi
is not equal to the mathematical constant pi! 😄
Yeah, good point. Num.Real
is probably too academic / pedantic anyways.
We currently have a
Float a
numeric type (e.g.Num.sqrt : Float a -> Float a
) which actually represents more than just floating-point numbers; it also representsDec
, which is fixed-point instead of floating-point.We should rename the
Num.Float
type toNum.Frac
instead (short for fraction, since all the numbers it represents are fractions.)