logo       

Unboxed integers: msg#00040

lang.haskell.glasgow.bugs

Subject: Unboxed integers

Hello,

There is something strange that is going on with unboxed types in GHC (6.2).
I think it is a bug, but perhaps I am missing something. If so, I am quite
curious as to what is going on. Here is the example:

> import GHC.Exts

First we define a function that will give us the bottom element of the unboxed
integers.

> bot :: () -> Int#
> bot () = bot ()

Now we can define a function that will "check" if we have bottom or not,
by terminating or not.

> stops :: Int# -> Bool
> stops _ = True
>
> test1 :: Bool
> test1 = stops (bot ())

As expected (by me), 'test1' does not terminate --- to unbox values we have to
be strict in them. So far everything makes sense. However if we simply make
'stops' into a local function, it starts terminating:

> test2 :: Bool
> test2 = stops (bot ())
> where
> stops :: Int# -> Bool
> stops _ = True

-Iavor


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise