3 ms·
I enjoy Haskell's approach to numbers. The type of any numeric literal is any type of the `Num` class. That means that they can be floating point, fractional,
by mFixman 7y ago
I enjoy Haskell's approach to numbers.
The type of any numeric literal is any type of the `Num` class. That means that they can be floating point, fractional, or integers "for free" depending on where you use them in your programs.
`0.75 + pi` is of type `Floating a => a`, but `0.75 + 1%4` is of type `Rational`.