Opened 6 years ago

Closed 6 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: Difficulty: Unknown
Test Case: deriving/should_run/T2529 Blocked By:
Blocking: Related Tickets:

Description

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 6 years ago by spl

  • Cc leather@… added

comment:2 Changed 6 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 6 years ago by simonpj

  • Difficulty set to Unknown
  • Owner set to simonpj

Excellent point thank you. Am fixing.

Simon

comment:4 Changed 6 years ago by simonpj

  • Resolution set to fixed
  • Status changed from new to closed
  • Test Case set to deriving/should_run/T2529

Fixed

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

Simon

Note: See TracTickets for help on using tickets.