Opened 13 years ago

Last modified 4 years ago

#116 new task

Read Char instance, for [Char], and ['a', 'b'] syntax

Reported by: Ian Lynagh Owned by: none
Priority: normal Milestone:
Version: Keywords:
Cc: Meta Owner:
State: discussion Section: N/A or multiple
Related Tickets:


Haskell 98, in section 10.4, states:

readsPrec will parse any valid representation of the standard types apart
from strings, for which only quoted strings are accepted

hugs follows this:

Hugs.Base> read "['a', 'b']" :: String
Program error: no parse

while GHC ignores it:

Prelude> read "['a', 'b']" :: String

The GHC libraries source shows that this is a wilful variation from H98:

  readListPrec =
    ( do L.String s <- lexP -- Looks for "foo"
         return s
      readListPrecDefault   -- Looks for ['f','o','o']
    )               -- (more generous than H98 spec)

I do not see the point of this inconsistency, so I believe we should consider changing it for Haskell'.

Change History (3)

comment:1 Changed 13 years ago by Ian Lynagh

component: HaskellPrimeProposal
Owner: changed from ijones to none

comment:2 Changed 4 years ago by Herbert Valerio Riedel


moving non-milestoned many year old legacy tickets out of the way

comment:3 Changed 4 years ago by Herbert Valerio Riedel

Priority: minornormal

Set default priority (as this confuses Trac otherwise)

Note: See TracTickets for help on using tickets.