
Inlining can only happen if the code to be inlined is available. This means explicitly marking things with {-# INLINE #-} or {-# INLINEABLE #-} (or GHC seeing something as "small" and deciding it's worth putting in the .hi file). If I give you "foo True" and tell you nothing more about "foo" - how are you going to optimise that? That's essentially what is happening - GHC has no more information so all it can do is just call the function and hope for the best. I don't understand. If the compiler can figure out how to inline certain functions automatically (without the use of the INLINE pragma), what's causing Monad binds and lifts to be out of the consideration set? Why do you say GHC has "no more information"? How does it have "more information" about functions that it does decide to inline automatically? -- Saurabh.