Plugins: Accessing unexported bindings

Eric Seidel eric at seidel.io
Sun Dec 6 19:08:55 UTC 2015


GHC should only drop un-exported bindings from the ModGuts if they're
also unused, ie *dead code*.

The only way I know to get around this is to use the bindings somewhere,
or just export them.

On Sat, Dec 5, 2015, at 23:01, Levent Erkok wrote:
> Hello,
> 
> The mg_binds field of the ModGuts seem to only contain the bindings that
> are exported from the module being compiled.
> 
> I guess GHC must be running user-plugins after it drops the bindings that
> are not exported, which makes perfect sense for most use cases. However,
> I'm working on a plugin where the end-programmer embeds "properties" in
> the
> form of functions inside his/her code, which are not necessarily exported
> from the module under consideration.
> 
> Is there a way to access all top-level bindings in a module from a
> plugin,
> even if those bindings are not exported?
> 
> Thanks,
> 
> -Levent.
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs


More information about the ghc-devs mailing list