On Fri, Aug 10, 2007 at 06:12:03PM +0100, Andrew Coppin wrote:
> > [big blob of simplifier output]
>> Mmm. See, now, I have *no idea* what GHC is saying. But I would have
> expected that if I do something like
>> x = if testBit 3 q ...
>> then the definition of testBit would get inlined, and then hopfully the
> optimiser would do something. But then, IANAGD. (I am not a GHC developer.)
Sure, it gets inlined, and you wind up with something like:
x = case 3 .&. (1 `shiftL` q) of
0 -> ...
_ -> ...
or, if you used the (correct and unintuitive) argument order to testBit:
x = case q .&. (1 `shiftL` 3) of
0 -> ...
_ -> ...
We *want* (1 `shiftL` 3) to be reduced to 8 at compile time, but that
doesn't seem to be happening.
(And I'm not a GHC developer either. I should probably start at some
point...)
Stefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20070810/54dd41b3/attachment.bin