[GHC] #7613: readSigned consumes too much input

GHC cvs-ghc at haskell.org
Mon Jan 21 10:40:10 CET 2013


#7613: readSigned consumes too much input
----------------------------------------+-----------------------------------
Reporter:  liyang                       |          Owner:                  
    Type:  bug                          |         Status:  new             
Priority:  normal                       |      Component:  libraries/base  
 Version:  7.6.1                        |       Keywords:                  
      Os:  Unknown/Multiple             |   Architecture:  Unknown/Multiple
 Failure:  Incorrect result at runtime  |      Blockedby:                  
Blocking:                               |        Related:                  
----------------------------------------+-----------------------------------
 {{{
 > reads "0.1" :: [(Int, String)]
 []
 }}}

 I would have expected {{{[(0, ".1")]}}}. The Report specifies that
 {{{reads}}} for {{{Int}}} ought to essentially be {{{readSigned
 readDec}}}, and indeed {{{readDec}}} gives the expected result:
 {{{
 > readDec "0.1"
 [(0,".1")]
 }}}

 I think the bug is due to the use of {{{lex}}} in {{{readSigned}}}, which
 consumes the entire "0.1" string, such that readDec no longer gives a
 clean parse.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7613>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the ghc-tickets mailing list