add Storable a => Storable (Ratio a) and Storable a => Storable (Complex a) to base
Michael Snoyman
michael at snoyman.com
Mon Nov 3 17:06:19 UTC 2014
On Mon, Nov 3, 2014 at 6:54 PM, Henning Thielemann <
lemming at henning-thielemann.de> wrote:
>
> On Mon, 3 Nov 2014, Carter Schonwald wrote:
>
> Getting those two into base for 7.10 would be quite nice.
>> I think this will mostly impact folks who maintain numerical computing
>> libraries, such as myself, and even
>> then, I think this would be a change well worth having!
>>
>
> Storable (Complex a) would be nice, but how can Storable (Ratio a) work
> reliably? (Storable a) means that values of type 'a' are represented by a
> fixed number of bytes. That is, for (Storable a => Ratio a) you would have
> a ratio of fixed size integers. Silent overflow in integers is already
> nasty, but in Ratios the effect of overflows is even worse.
>
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?
Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20141103/f45f2da6/attachment-0001.html>
More information about the Libraries
mailing list