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

wren ng thornton wren at freegeek.org
Thu Mar 28 19:10:54 CET 2013


On 3/27/13 12:16 PM, Henning Thielemann wrote:
>
> 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.

+1.

-- 
Live well,
~wren



More information about the Libraries mailing list