subtle inlining problem

Bulat Ziganshin bulat.ziganshin at
Thu Nov 9 02:14:57 EST 2006

Hello Simon,

Wednesday, November 8, 2006, 8:41:51 PM, you wrote:
>> {-# INLINE getInteger #-}
>> getInteger = ... -- large definition that will be not inlined
>>                  -- without pragma
>> get = getInteger

> Here, getInteger will be inlined in the RHS of get, but GHC doesn't
> see any reason that 'get' should be inlined.

> If you want that, add an INLINE pragma on get.

> The same thing should work in an instance decl, for the same
> reason, but I have not tried it recently.   And, assuming it does
> work, it ought to be documented.  If you check, and send me draft
> words, I'll add them to the user manual

ok, but i don't undertsand what you mean by "it does work"? should i
check that without INLINE pragma it's not inlined and with pragma it's

also, that you think about changing implementation to that i implied -
any function equivalent to inlined function, should be also inlined?
in terms of implementation complexity and whether it will be good or
bad change? for my particular program (AltBinary lib) it will allow to
remove a couple of INLINE pragmas. and if someone want to create not
inlined version of some inlined function, he can easily write

{-# NOINLINE get #-}

Best regards,
 Bulat                            mailto:Bulat.Ziganshin at

More information about the Glasgow-haskell-users mailing list