Is there a way to force all exported functions to be no-inline

If I understand well, not inlining top functions helps reduce unnecessary recompilation.
I have a Yesod app where all handlers (top level function corresponding to an Http request) don’t need to be inlined. Is there a way to force GHC to not inline those handles en-mass (instead of having one NoInline pragma per function).

Yes: -fomit-interface-pragmas (this disables all cross-module optimisations)

Or alternatively: -funfolding-creation-threshold=0 (this disables only inlining, but I think it also affects inlining in the same module)

1 Like

Interesting, is it on a project of module basis ?

I think it works per-module, just like -O0. But you can add global ghc-options to your cabal file to apply it too all modules in your project at once.

1 Like

Umm, it seems it is set by default when -O0 so I shouldn`t need it. I’ll investigate.

Yes, -O0 implies -fomit-interface-pragmas. But you probably don’t want to fully disable all optimizations, do you?