Skip to content

INLINE pragma doesn't trigger on locally defined function

I have a function on the form

f = ...g...
  where
    g = ...h...
    h = ...step...
      where step
        | ... = ...g...
        | ... = ...step...
    {-# INLINE h #-}
{-# INLINE f #-}

GHC refuses to inline h, even with an explicit INLINE pragma. I realize that h is part of a loop, g->h->step->g, but it seems to me that it should be possible to inline the non-recursive h anyway.

I've attached a standalone test case (which is a quite a bit longer.) The function f above corresponds to filterWithKey in the test case.

Trac metadata
Trac field Value
Version 7.4.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information