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  [EMAIL PROTECTED]

-----------------
Serge Mechveliani
[EMAIL PROTECTED]





_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to