The numeric c types are (effectively) integral, too.

Henning Thielemann lemming at
Wed Mar 27 17:16:09 CET 2013

On Wed, 27 Mar 2013, Jeff Shaw wrote:

> On Wednesday, March 27, 2013 11:30:24 AM, Henning Thielemann wrote:
>> I don't think that an Integral instance is the right way
>> to go, since it would imply the signature:
>> div :: CTime -> CTime -> CTime
>> and the quotient of two time values is not a time.
> That is irrelevant.

It is highly relevant and certainly a major difference between Haskell and 
C. A time can be represented with any unit and with either integer or 
floating or fixed-point numbers. Actually, the integer can always be read 
as fixed-point number, since the unit is somehow arbitrary. The quotient 
of two time values is not a time value but a scalar value and it is good 
if Haskell alerts you when you mix them up.

More information about the Libraries mailing list