GHC plugin without registering the plugin

Andrew Farmer afarmer at
Sun May 5 23:31:20 CEST 2013

I've also been trying to find a good way to do this. I had a somewhat hacky
driver that would use GHC to compile the plugin in a temporary directory,
then create a custom package database with only that plugin and add that
database to the stack of package databases when compiling the target
program. The annoying part was creating the package description, as you
need to determine which other packages the plugin depends on. However, it
just occurred to me that "ghc --make" does this, so its probably a matter
of finding the proper GHC API call to get the list of packages used to
build the plugin and converting that into a package description.

Can anyone familiar with either the plugin API or Cabal/ghc-pkg comment on
whether there is an easier way?


On Sat, May 4, 2013 at 8:07 PM, Erik de Castro Lopo <mle+hs at>wrote:

> Hi all,
> I'm messing about with writing a GHC plugin and looking at the
> documentation here:
> which states:
>     Plugins can be specified on the command line with the option
>     -fplugin=module where module is a module in a registered package
>     that exports a plugin.
> Is there anyway I can have a plugin in my local source tree rather than
> being installed and registered? Not having to cabal install it would make
> development and debugging somewhat easier.
> Cheers,
> Erik
> --
> ----------------------------------------------------------------------
> Erik de Castro Lopo
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the ghc-devs mailing list