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

Krzysztof Skrzętnicki gtener at gmail.com
Wed Mar 27 21:35:12 CET 2013


I second this. The fact that time_t is sometimes uint or anything else is
simply implementation detail (unless one can point to relevant standards
that say otherwise). If one wishes to bet on this being true then simple
private newtype with proper instances seems like the way to go. But it
feels insecure to do otherwise.


Cheers,
Krzysztof Skrzętnicki

On Wed, Mar 27, 2013 at 5:16 PM, Henning Thielemann <
lemming at henning-thielemann.de> 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.
>
>
> ______________________________**_________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/**mailman/listinfo/libraries<http://www.haskell.org/mailman/listinfo/libraries>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20130327/c7475097/attachment.htm>


More information about the Libraries mailing list