Opened 9 years ago

Closed 9 years ago

#2529 closed bug (fixed)

deriving Read fails on infix data constructors with record syntax

Reported by: spl Owned by: simonpj
Priority: normal Milestone:
Component: Compiler Version: 6.8.3
Keywords: Cc: leather@…
Operating System: MacOS X Architecture: x86
Type of failure: None/Unknown Test Case: deriving/should_run/T2529
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


The example below successfully performs the show, but reads returns an empty list. It fails in both GHCi and GHC. It succeeds if you replaces the infix symbol with a name.

module Main where

data A = (:<>:) { x :: Int, y :: Int } deriving (Read, Show)

t :: A
t = 1 :<>: 2

s :: String
s = show t

r :: [(A,String)]
r = reads s

main :: IO ()
main = do putStrLn s
          putStrLn (show r)

Change History (4)

comment:1 Changed 9 years ago by spl

Cc: leather@… added

comment:2 Changed 9 years ago by spl

I suppose it would've been helpful to include GHCi output, though it is trivial:

Prelude Main> main
(:<>:) {x = 1, y = 2}

comment:3 Changed 9 years ago by simonpj

difficulty: Unknown
Owner: set to simonpj

Excellent point thank you. Am fixing.


comment:4 Changed 9 years ago by simonpj

Resolution: fixed
Status: newclosed
Test Case: deriving/should_run/T2529


Thu Aug 28 13:10:06 BST 2008
  * Fix Trac #2529: derived read for prefix constructor operators


Note: See TracTickets for help on using tickets.