patch applied (ghc): The Big INLINE Patch: totally reorganise way that INLINE pragmas work

Duncan Coutts duncan.coutts at googlemail.com
Thu Oct 29 14:31:58 EDT 2009


On Thu, 2009-10-29 at 08:58 -0700, Simon Peyton Jones wrote:

>   The CONLIKE pragma
>   ~~~~~~~~~~~~~~~~~~
>   In the DPH project, Roman found cases where he had
>   
>      p n k = let x = replicate n k
>              in ...(f x)...(g x)....
>   
>      {-# RULE f (replicate x) = f_rep x #-}
>   
>   Normally the RULE would not fire, because doing so involves 
>   (in effect) duplicating the redex (replicate n k).  A new
>   experimental modifier to the INLINE pragma, {-# INLINE CONLIKE
>   replicate #-}, allows you to tell GHC to be prepared to duplicate
>   a call of this function if it allows a RULE to fire.

Cool. I recall we found cases where this would be useful when we were
doing the list stream fusion. It's probably help cheap [n..m]-like
things for build/fold too.

Duncan



More information about the Cvs-ghc mailing list