1 -- !!! Deriving Show/Read for nullary constructors.
2 module Main(main) where
4 data A = B | C deriving ( Show, Read )
6 data Opt = N | Y A deriving (Show, Read)
11 If the Haskell report's specification of how Show instances
12 are to be derived is followed to the letter, the code for
13 a nullary constructor would put parens around the constructor
14 when (showsPrec 10) is used. This would cause
22 Overkill, so ghc's derived Show code treats nullary
23 constructors specially.
28 print ((read (show x))::Opt)
29 print ((read "Y (B)")::Opt)