Unboxed singleton tuples
Tim Chevalier
catamorphism at gmail.com
Fri Aug 15 15:07:44 EDT 2008
On 8/14/08, Roman Leshchinskiy <rl at cse.unsw.edu.au> 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)
?
(Or are the singleton tuples a way to avoid using seq and its friends?)
Cheers,
Tim
--
Tim Chevalier * http://cs.pdx.edu/~tjc * Often in error, never in doubt
"I wish people weren't so set on being themselves, when that means
being a bastard." -- Robertson Davies
More information about the Cvs-ghc
mailing list