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

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to