Tim Chevalier wrote:
On 8/14/08, Roman Leshchinskiy <[EMAIL PROTECTED]> wrote:
 IIUC, the practical difference is this. If you have

  f :: Int -> (# Int #)

 then

  case f m of (# n #) -> bar n

 will call f before calling bar but will not evaluate n.

I fear I'm still not enlightened. I see how your example works, but in
the particular context where GHC introduces these singleton tuples,
the tuple will contain an unboxed value (the result of a foreign
function call.) So if n is unboxed, isn't
case f m of (# n #) -> bar n
exactly equivalent to
bar $! (f m)
?

Yes - in the case where the value is unboxed (or unlifted), it makes no difference to wrap it in a singleton unboxed tuple. I actually have no idea why we use (# State# RealWorld #) rather than just State# RealWorld in that case. Perhaps we could just change it, because the return convention is the same in both cases.

Cheers,
        Simon

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to