
9 Apr
2001
9 Apr
'01
7:55 p.m.
Hello, is there an easy way to box/unbox Types. I need this for Int's, so is there a function that does: Int# -> Int Int -> Int# Regards, Thomas

10 Apr
10 Apr
3:53 a.m.
Hello! On Tue, Apr 10, 2001 at 01:55:21AM +0200, Thomas Pasch wrote:
is there an easy way to box/unbox Types. I need this for Int's, so is there a function that does:
Int# -> Int Int -> Int#
You must import the appropriate modules, to "see" the type definition for Int (which is data Int = I# Int# in GHC). Then just use plain pattern matching: unboxInt :: Int -> Int# unboxInt (I# i#) = i# boxInt :: Int# -> Int boxInt i# = I# i# Note that there are some restrictions for handling unboxed values, see the documentation. Kind regards, Hannah.
8810
Age (days ago)
8811
Last active (days ago)
1 comments
2 participants
participants (2)
-
Hannah Schroeter
-
Thomas Pasch