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

Henning Thielemann lemming at henning-thielemann.de
Mon Nov 3 17:13:24 UTC 2014



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)


More information about the Libraries mailing list