Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#7613 closed bug (wontfix)

readSigned consumes too much input

Reported by: liyang Owned by:
Priority: normal Milestone:
Component: libraries/base Version: 7.6.1
Keywords: Cc: hackage.haskell.org@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect result at runtime Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

> 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.

Change History (3)

comment:1 Changed 2 years ago by liyang

  • Cc hackage.haskell.org@… added

comment:2 Changed 2 years ago by igloo

  • difficulty set to Unknown
  • Resolution set to wontfix
  • Status changed from new to closed

As far as I can see, we're following the report here. If you'd like to propose a change in the behaviour, please see http://www.haskell.org/haskellwiki/Library_submissions

comment:3 Changed 2 years ago by liyang

http://comments.gmane.org/gmane.comp.lang.haskell.libraries/14508

Just found the above thread. Turns out this is a duplicate of #4500. I ended up with Attoparsec on UTF-8 ByteStrings which behaves the way I expect, and is about 5x faster.

Note: See TracTickets for help on using tickets.