Read/Show Incompatibility in base
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:
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.
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |