converting to & from unboxed types

Simon Marlow simonmar@microsoft.com
Wed, 19 Dec 2001 09:34:44 -0000


>=20
> I'm sure this is common knowledge but I can't find it=20
> anywhere in the ghc
> docs.  How do you take, say, an Integer and "unbox" it and=20
> get an Int# or
> something?

 import GlaExts

 unbox :: Int -> Int#
 unbox (I# i) =3D i

 box :: Int# -> Int
 box i =3D I# i

Cheers,
	Simon