let (d,k) = (g x y, h x d) ..
Serge D. Mechveliani
mechvel@botik.ru
Fri, 27 Jun 2003 12:22:46 +0400
Dear Haskellers,
Once I wrote a function
f' :: Int -> Int -> Int -> (Int, Int)
f' n m l = let (d,k) = (gcd n m, quot n d) in (k, l*k)
(the simplified version of real program),
placing erroneousely d to both parts of the pattern matching
(d,k) = ...
The intended program was
f n m l = let {d = gcd n m; k = quot n d} in (k, l*k)
But f' gives the intended results, at least in the GHC
implementation.
So that I did not notice the `error' for a long time.
Is really the Haskell pattern matching semantic so that f and f'
are equivalent ?
Is it an occasional implementation feature that hide the `error'?
Thank you in advance for the explanation.
Answer, please, to mechvel@botik.ru
-----------------
Serge Mechveliani
mechvel@botik.ru