[GHC] #12874: Read/Show Incompatibility in base

GHC ghc-devs at haskell.org
Wed Nov 23 18:55:10 UTC 2016


#12874: Read/Show Incompatibility in base
-------------------------------------+-------------------------------------
           Reporter:  andrewthad     |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 I just stumbled across a situation where the deriving machinery, in
 combination with types provided by base, produces Show/Read instances that
 are incompatible. Here is a minimal example:

 {{{#!hs
 import Data.Proxy

 main :: IO ()
 main = do
   x <- readLn
   print (x :: Thing (Proxy Int))

 data Thing a = Thing a
   deriving (Read,Show)
 }}}

 If you run this program and type "Thing Proxy" into standard in, you get a
 parse error. If you type in "Thing (Proxy)", it works fine. Calling `show`
 on `Thing Proxy` gives the string "Thing Proxy" though. So, `read . show
 =/= id` in this case. This might just be an issue with `Proxy`'s Read
 instance, but I'm not really sure.

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


More information about the ghc-tickets mailing list