The problem is that you're using IIModule
. This indicates that you want to bring the module and everything in it, including non-exported stuff into the context. It's essentially the same as :load
with an asterisk in GHCi. And as you've noticed, this only works with interpreted code since it let's you "look inside" the module.
But that's not what you need here. What you want is to load it as if you used :module
or an import
declaration, which works with compiled modules. For that, you use IIDecl
which takes an import declaration which you can make with simpleImportDecl
:
setContext [IIDecl $ simpleImportDecl (mkModuleName "Plugin")]