Michael Orlitzky <michael@orlitzky.com> schrieb am Mo., 15. Aug. 2016 um 14:48 Uhr:
On 08/14/2016 06:54 PM, David Feuer wrote:
> 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.
>

One potential gotcha:

  ghci> read (show (1/3)) == (1/3)
  True
  ghci> read (show (1/3 :: Float)) == (1/3)
  False

When does it work? Is it platform-dependent?

Well, you are showing 1/3 as a Float and reading it as a Double, which of course won't work since the String represents a Float and not a Double. The following does work:

λ: read (show (1/3 :: Float)) == ((1/3) :: Float)
True