Runnig a compiler plugin over ALL code

Tillmann Vogt tillk.vogt at
Wed Feb 9 11:16:22 UTC 2022


I am running a compiler plugin over hundreds of libraries to extract 
statistical data. I use the plugin like it is done here:

So I just have to add a cabal.project.local to a library with:

ignore-project: False

package test
     ghc-options: -package-db=/home/till/.cabal/store/ghc-8.10.7/package.db

But unfortunately the plugin only runs over code that is used in the 
main function or that is used in other functions.


main = putStrLn (show (f 0))

f x = sin x

g = h + i

Then the compiler plugin only runs over f, h, i   but not not g (unused 
top level functions).

Can the plugin be forced to run over all code?


More information about the ghc-devs mailing list