<p dir="ltr">Since decimal notation is defined in terms of fromRational, it seems a bit strange that the notation doesn't work for read::String->Rational. I'd be in favor of allowing it. I wouldn't expect too severe a performance penalty.</p>
<div class="gmail_extra"><br><div class="gmail_quote">On Aug 14, 2016 5:28 PM, "Sean Leather" <<a href="mailto:sean.leather@gmail.com">sean.leather@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">Hi Erik,</div><div class="gmail_quote"><br></div><div class="gmail_quote">On Sun, Aug 14, 2016 at 11:01 PM, Erik Hesselink wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On 14 August 2016 at 16:00, Sean Leather wrote:<br>
> On Sun, Aug 14, 2016 at 9:48 PM, Tom wrote:<br>
>><br>
>> Is there a reason to not allow '.' as a separator for Rational's Read<br>
>> instance, so that both "1%2" and "0.5" can be read?<br>
><br>
> While it would make read :: String -> Rational more convenient, I'm not sure<br>
> it would be a good idea to have read accept input that will never be<br>
> produced by show :: Rational -> String.<br>
<br>
</span>This already happens everywhere, right? For example, if you have a Foo<br>
{ bar :: Int, baz :: String } with the derived read instance, this<br>
works:<br>
<br>
read "Foo{bar=0x01, baz = \"h\101llo\"}" :: Foo<span><font color="#888888"><br></font></span></blockquote><div><br></div><div>True. I'm not sure how far down the decimal/scientific notation parsing hole you'd want to take the Ratio Read instance. Anyway, my point was that there is an existing alternative that doesn't require changing the instance and is not that inconvenient.</div><div><br></div><div>Regards,</div><div>Sean</div></div></div></div>
<br>______________________________<wbr>_________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-<wbr>bin/mailman/listinfo/haskell-<wbr>cafe</a><br>
Only members subscribed via the mailman list are allowed to post.<br></blockquote></div></div>