How do you stop functions being inlined?

George Russell ger@tzi.de
Wed, 01 Aug 2001 16:46:18 +0200


Well, I think we all know the answer to this one, namely 
   {-# NOINLINE [name] #-}
This is, after all, what GHC does, and what several of the
files in ghc/fptools do.

Only slight problem is that according to the Haskell 98
report, including Simon Peyton Jones' revised draft, you
should use:
   {-# notInline [name] #-}
Most of the time in fptools/hslibs (which I have from
GHC), NOINLINE is used, but in one case notInline is used.

Of course one of the delights of pragmas is that the
"pragma should be ignored if an implementation is not prepared to 
handle it.".  So if you guess wrong, you may never know, until
you get a mysterious bug from GHC inlining a call to create
a global variable via unsafePerformIO.  Aren't pragmas wonderful?

Would someone tell me which we are supposed to use?  Or should I
use both "NOINLINE" and "notInline", just to be on the safe side?