Julian Seward (Intl Vendor)
Mon, 4 Jun 2001 03:21:25 -0700
| > In ghc-5.00.1, "seq (2/0) 3" gives 3. Should it not give=20
| error. Hugs does.
| I suspect that Hugs is wrong and ghc is right in this case.=20
| Certainly nhc98 and hbc agree with ghc's behaviour.
| seq x y means evaluate x to whnf and throw away the result,=20
| returning y instead. It shouldn't matter whether the result=20
| of x is bottom.
This doesn't seem a correct explaination to me. seq _|_ anything =3D=3D =
The reason that it doesn't bomb in GHCi, and I presume nhc98 and hbc is
because the type of (2/0) is Fractional a =3D> a, which is defaulted to
Double. However, 2/0 :: Double is a well defined value -- an IEEE754=20
Infinity (try it)! =20
I think what Saswat expected to see can be made to happen if you force
the division to be an integer division:
Prelude> seq (2 `div` 0) 3 =20
Floating point exception