[Haskell-cafe] Re: pi

ok ok at cs.otago.ac.nz
Wed Oct 10 21:39:43 EDT 2007

On 11 Oct 2007, at 1:34 pm, Dan Weston wrote:

> Actually, [pi] is a constant: piDecimalExpansion :: String.

No, that's another constant.
> A translation from piDecimalExpansion :: String to pi :: Floating a  
> => a is already well defined via read :: Read a => String -> a

Wrong.  piDecimalExpansion would be infinite.  pi is, after all,
a transcendental number.  It can be computed incrementally by a
finite algorithm, true.  The problem is that read has to read
*all the way to the end*, and there is no end.  (More precisely,
either to the end of the string or to the first character that is
not part of a floating point literal.)

> Any definition of pi in the Floating class that differs from (read  
> piDecimalExpansion) is erroneous.

In effect, you are proposing that the only non-erroneous
definition of pi is bottom.

I don't think that is very helpful.

More information about the Haskell-Cafe mailing list