
15 Feb
2011
15 Feb
'11
4:45 p.m.
Max Bolingbroke wrote:
On 15 February 2011 15:12, Roman Leshchinskiy
wrote: Ah, but you assume that bar won't be inlined into foo first. Consider that it is perfectly acceptable for GHC to generate this:
foo = <big> {-# INLINE bar #-} bar = <big>
We did ask to inline bar, after all.
Well, yes, but when considering the use site for foo don't we now inline the *original RHS* of foo? This recent change means that it doesn't matter whether bar gets inlined into foo first - use sites of foo will only get a chance to inline the "bar" RHS.
Only if foo has an INLINE pragma. Otherwise, GHC uses whatever RHS is available when it wants to inline. Roman