[Haskell-cafe] Proposal: Rational read

Michael Orlitzky michael at orlitzky.com
Mon Aug 15 12:39:25 UTC 2016

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)
  ghci> read (show (1/3 :: Float)) == (1/3)

When does it work? Is it platform-dependent?

More information about the Haskell-Cafe mailing list