Re: coredump on innocent code
Ross Paterson <[email protected]> Sat, 10 Sep 2005 17:18:43 +0100
| Newsgroups | gmane.comp.lang.haskell.hugs.bugs |
|---|---|
| Message-ID | <[email protected]> |
On Sat, Sep 10, 2005 at 03:18:16PM -0000, [email protected] wrote: > I previously thought that rewriting > > let <a> = <b> > <c> = <d> in <e> > > as > > let (<a>,<c>) = (<b>,<d>) in <e> > > is harmless, but section 3.12 of the Report says different. Yes, you'd have to write it as let (~<a>,~<c>) = (<b>,<d>) in <e> > I still don't understand why > > main = print (let (x,(q,_)) = (1,divMod x x) in q) > > and > > main = print (let (x,(q,_)) = (1,divmod x x) in q) > divmod x y = (div x y,mod x y) > > behave differently. In both cases, to for x is to ask for the rhs to be reduced to the form (<a>,(<b>,<c>)). In the former case this can't be done without knowing the value of x; in the latter it can.