On 15/08/2008, at 07:11, Tim Chevalier wrote:
While reading some Core code, I noticed a function whose return type
was (# State# RealWorld #). I was curious why unboxed tuples of arity
1 would exist, so I dug around in the GHC sources and found that they
are used when desugaring foreign calls, as per the comment at the
beginning of boxResult in deSugar/DsCCall.lhs. But I still don't
understand -- what's the difference between (# foo #) and foo?
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. (# a #) is
basically the same as
data Id a = Id a
but without the boxing.
Roman
_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc