subtle inlining problem

Simon Peyton-Jones simonpj at
Thu Nov 9 03:29:18 EST 2006

| > 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
| inlined?

I meant that I'm not 100% sure that an INLINE pragma in an *instance declaration* will cause the method to be inlined.  I think it works, but it'd be worth checking.

| also, that you think about changing implementation to that i implied -
| any function equivalent to inlined function, should be also inlined?

Definitely not.  It'd be a strange special case.  What about
        get = id getInteger
        get = id (id getInteger)

Initially these don't look like "equivalent to inlined function" but they are.  What about
        get = [getInteger] !! 1

Perhaps you could say that something magic happens when you, the programmer write x=y, and y has an INLINE pragma... but my instinct is to keep GHC's simple, rule.


More information about the Glasgow-haskell-users mailing list