
3 Nov
2014
3 Nov
'14
5:13 p.m.
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)