[GHC] #11170: (read ".9") :: Double unable to parse

GHC ghc-devs at haskell.org
Fri Jan 8 20:35:59 UTC 2016


#11170: (read ".9") :: Double unable to parse
-------------------------------------+-------------------------------------
        Reporter:  varosi            |                Owner:
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:
       Component:  Core Libraries    |              Version:  7.10.2
      Resolution:  invalid           |             Keywords:  Read, report-
                                     |  impact
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect result  |  Unknown/Multiple
  at runtime                         |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by ekmett):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 The lexical syntax specified in the Haskell 98 Report here:
 https://www.haskell.org/onlinereport/syntax-iso.html#sect9.2 gives

 {{{
 float   ->      decimal . decimal [exponent]
         |       decimal exponent
 }}}

 A change to the report here would haphazardly change the semantics and
 behavior of code that currently typecheck.

 Like it or not, in the presence of the rather common

 {{{#!hs
 instance Num b => Num (a -> b) where
   f + g = \x -> f x + g x
   fromIntegral n = \x -> fromIntegral n
   ...
 }}}

 then `(.9)` parses today as precomposition with the constant function that
 returns 9.

 `abs .9` is a composition of abs and the function you obtain above from 9,
 etc.

 In the absence of such a change to the Haskell Report I'd say we should
 close this as a `invalid` (or `wontfix`) as it steps outside of the
 mandate of `read` for the language as it exists. From the standpoint of
 the libraries committee I'm going to close this out as such.

 In the unlikely event that the haskell-prime committee changes the
 language we have such that .9 parses as a `Fractional` value then we'd be
 faced with the dilemma of how to support both old and new standards on the
 library front. Feel free to reopen this if that happens and we'll be
 forced to figure out what to do.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11170#comment:13>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list