[Haskell-cafe] Re: Derived Read instance for types with infix constructors (ghc 6.4.1)

Misha Aizatulin avatar at hot.ee
Sat Aug 26 15:15:17 EDT 2006


Neil Mitchell wrote:
>> *Main> show $ A `And` A
>> "A And A"
> 
> For me, using GHCi 6.4.2 + Windows, I get:
> "A `And` A"

  I installed GHC 6.4.2 now (on Linux). It really does print "A `And`
A", but still doesn't read it. Would you agree that GHC doesn't conform
to the Haskell Report here? In fact it seems to produce a Read instance
with no valid input for it!

Daniel Fischer wrote:
> Put the constructor in the prefix position in the data definition and
> the derived Read instance of ghc 6.4.1 will also be able to read the
> prefix form.

  This might be a solution, but I was hoping that I can have a Read
instance that would read the infix form - this would be more natural for
the data I have (like logical expressions).

Cheers,
  Misha


More information about the Haskell-Cafe mailing list