On 09/01/2012 04:46, wren ng thornton wrote:
On 12/23/11 8:34 AM, Simon Peyton-Jones wrote:
More uniform! If you the singleton-unboxed-tuple data constructor in
source code, as a function, you'd write (\x -> (# x #)). In a pattern,
or applied, you'd write (# x #).

Shouldn't (# T #) be identical to T?

No, because (# T #) is unlifted, whereas T is lifted. In operational terms, a function that returns (# T #) does not evaluate the T before returning it, but a function returning T does. This is used in GHC for example to fetch a value from an array without evaluating it, for example:

  indexArray :: Array# e -> Int# -> (# e #)

Cheers,
        Simon


I know that a putative (T) would be different from T because it would
introduce an additional bottom, but I don't think that would apply to
the unboxed case. Or is there something in the semantics of unboxed
tuples that I'm missing?


_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to