darcs patch: implement prefix unboxed tuples syntax (#1509)

Simon Marlow simonmarhaskell at gmail.com
Fri Jan 4 05:36:16 EST 2008


Isaac Dupree wrote:

> would implementing that make it harder or easier for ghci to support 
> unboxed tuples?

Slightly easier, in that construction (of unboxed tuples with lifted 
components only) could be done by calling the curried construction 
functions in PrimopWrappers.

Deconstruction could be done in a similar way; that is we need a family of 
functions like

liftUbx2 :: (State# -> (# a, b #)) -> (a, b)

the State# argument is just a hack to lift the unboxed tuple.  So you could 
then compile

   case f x of
     (# a, b #) -> ...

into

   let f' = \s -> f x in
   case liftUbx2 f' of
     (a, b) -> ...

but this only works for unboxed tuples with lifted components.  You could 
also generate some similar wrappers for particular instances of unboxed 
tuples with unlifted components.  Doesn't sound particularly attractive, 
though.

Cheers,
	Simon



More information about the Cvs-ghc mailing list