[Hugs-bugs] coredump on innocent code
Ross Paterson
ross at soi.city.ac.uk
Sat Sep 10 12:18:43 EDT 2005
On Sat, Sep 10, 2005 at 03:18:16PM -0000, fool at sdf-eu.org 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.
More information about the Hugs-Bugs
mailing list