Re: nhc98-1.00 bug report



About this list Date view Thread view Subject view Author view

Thomas Hallgren (hallgren@cs.chalmers.se)
Tue, 21 Nov 2000 15:44:09 +0100


Malcolm Wallace wrote: > > Bug #1. > > module NewtypeBug where > > newtype T a = C a > > gives > > Fail: Couldn't find rhs of newtype: NewtypeBug.T > > Two conflicting datatype definitions? > > This kind of renaming looks strange to me, but it appears to be legal, > so I have fixed nhc98 to accept it. Imagine that you have a large data type for which you want to derive equality, but one constructor argument is of a type that does not admit equality: data T = C1 ... | ... | Ci ... (Int->Int) ... | ... deriving Eq Then you could define the type newtype NoEq a = N a instance Eq (NoEq a) where x==y = True wrap the argument: data T = C1 ... | ... | Ci ... (NoEq (Int->Int)) ... | ... deriving Eq and everyting will be fine. > > Bug #2. > > module RebindBug where > > f = x where > > (x,_) = (x,()) > > where x = () > > the Report says > f = let (x,_) = > let x = () in (x,()) -- this defn not redundant > in x > which does look much like the `where' version at all if you ask me. > Anyway, I don't yet have a bugfix for this one, but it shouldn't be > too difficult. The definition perhaps made more sense in its original context. I stripped it down as far as possible, leaving only enough stuff to trigger the bug: a pattern binding of a variable that is rebound in a local "where" clause. Renaming the local variable should give something with the same meaning: f = x where (x,_) = (x2,()) where x2 = () Regards, Thomas H


About this list Date view Thread view Subject view Author view