The drain combinator is marked to be inlined in phase 2.
See this commit in the streamly repo. If the readDrain function is annotated plainly as INLINE then GHC is not able to inline it in the first phase (phase-2) for some reason because it is shared at two places in the bench group table. This has an effect that the drain does not fuse. If we mark readDrain as INLINE[2] then it fuses.
I have not investigated deeply but my guess is that if an underlying fusible function is marked to be inlined in a specific phase then we need to propagate that information to the functions that directly or indirectly call that function so that we can ensure that it is inlined in that phase.
The
draincombinator is marked to be inlined in phase 2.See this commit in the streamly repo. If the
readDrainfunction is annotated plainly asINLINEthen GHC is not able to inline it in the first phase (phase-2) for some reason because it is shared at two places in the bench group table. This has an effect that the drain does not fuse. If we markreadDrainasINLINE[2]then it fuses.I have not investigated deeply but my guess is that if an underlying fusible function is marked to be inlined in a specific phase then we need to propagate that information to the functions that directly or indirectly call that function so that we can ensure that it is inlined in that phase.