[Haskell] Expecting more inlining for bit shifting

John Meacham john at repetae.net
Thu Oct 19 09:45:42 EDT 2006


On Wed, Oct 18, 2006 at 07:00:18AM -0400, roconnor at theorem.ca wrote:
> I'm not sure this approach is best.  In my case the ... needs to be the 
> entire body of the shift code.  It would be ridiculous to have two copies 
> of the same code.  What would be better is a hint pragma that says, 
> ``inline me if the following set of parameters are literals''.
> 

not at all:

> {-# RULES "shift/const-inline"  
>    forall x y# . shift x y# = inline shift x y# #-}

of course, you would still need to make sure the body of shift were
available. (perhaps instances of inline in rules should force the
argument to appear in the hi file in full)

a hint pragma would be trickier to implement and not as flexible I would
think. for instance, what if you want to inline only when one argument
is an arbitrary constant, but the other arg is a certain value?

        John
-- 
John Meacham - ⑆repetae.net⑆john⑈


More information about the Glasgow-haskell-users mailing list