add Storable a => Storable (Ratio a) and Storable a => Storable (Complex a) to base

Michael Snoyman michael at snoyman.com
Mon Nov 3 17:15:47 UTC 2014


On Mon, Nov 3, 2014 at 7:13 PM, Henning Thielemann <
lemming at henning-thielemann.de> wrote:

>
>
> On Mon, 3 Nov 2014, Michael Snoyman wrote:
>
>  I may be missing something, but wouldn't the `Storable` constraint ensure
>> that only integral types with a
>> fixed size can be stored? Said another way, `Ratio a` is isomorphic to a
>> strict pair of `a`, and the latter
>> can clearly be serialized without any loss of precision. Why would `Ratio
>> a` be any different?
>>
>
> You can serialize it without problems, but the arithmetic of Ratios with
> fixed size integers is pretty, say, non-standard. :-)
>
> E.g.
>
> Prelude Data.Ratio> 1%29 + 1%31 :: Rational
> 60 % 899
>
> Prelude Data.Ratio> 1%29 + 1%31 :: Int8
> 12 % (-25)
>

In other words, you don't disagree with the `Storable` instance itself
being valid, it's just that it encourages bad practice?

Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20141103/f86eed36/attachment.html>


More information about the Libraries mailing list