[Haskell-cafe] Numerals in input vs numerals in source
Brandon Allbery
allbery.b at gmail.com
Wed Sep 24 03:49:15 UTC 2014
On Tue, Sep 23, 2014 at 11:19 PM, Doug McIlroy <doug at cs.dartmouth.edu>
wrote:
> Yet (1::Integer, 1::Rational, 1::Double) evaluates to (1, 1%1, 1.0)
>
> Is the inconsistent parsing defensible, or just an (irrational!) fact?
> I believe a reconciliation would break nothing.
>
The parsing is the same; read is not expected to throw a fromIntegral into
the mix, whereas the compiler is required to. (The 1 is parsed as Integer
by the compiler in all three cases, but the resulting AST is (fromIntegral
1) in all three cases.)
I suspect a Read instance that included a fromIntegral would be even more
irrational.
--
brandon s allbery kf8nh sine nomine associates
allbery.b at gmail.com ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140923/a068fef1/attachment-0001.html>
More information about the Haskell-Cafe
mailing list