[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haskell-cafe
Subject:    Re: [Haskell-cafe] Derived Read instance for types with infix
From:       Daniel Fischer <daniel.is.fischer () web ! de>
Date:       2006-08-27 12:18:17
Message-ID: 200608271415.14963.daniel.is.fischer () web ! de
[Download RAW message or body]

Am Sonntag, 27. August 2006 01:02 schrieb Daniel Fischer:
> Extremely odd,
>
> today ghc 6.4.2 (also on linux) works for me, too:
> Prelude InfixR> show (A `And` A)
> "A `And` A"
> Prelude InfixR> show (And A A)
> "A `And` A"
> Prelude InfixR> read (show (And A A)) :: T
> A `And` A
> Prelude InfixR> read "And A A" :: T
> *** Exception: Prelude.read: no parse
> Prelude InfixR> read "A `And` A" :: T
> A `And` A
>
> (and it can't read "And A A", which is what ghc 6.2.2 could read),
> yesterday it couldn't read either form.
>
> What sort of hiccough could produce such behaviour?????????
>
> Bewildered,
> Daniel

Probably my sleep deprived memory erred and what couldn't read either form
was ghc 6.4.1. Bash history confirms that this is definitely a possibility.
And since it's far easier to believe that I erred in this respect than that 
the derived Read instance of one day could read what that from another day 
couldn't, I'm pretty sure that's what happened.
Sorry.

Another thing:
Would it be a good idea to create derived Read instances that could parse 
both, "A `And` A" and "And A A" ?
Since 6.4.2 parses the former and 6.2.2 parses the latter that should be 
possible, I believe (and both forms are accepted at the ghci prompt).

Cheers,
Daniel

-- 

"In My Egotistical Opinion, most people's C programs should be
indented six feet downward and covered with dirt."
	-- Blair P. Houghton


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic