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?

Thanks!
Andrew


On Sat, May 4, 2013 at 8:07 PM, Erik de Castro Lopo <mle+hs@mega-nerd.com> wrote:
Hi all,

I'm messing about with writing a GHC plugin and looking at the
documentation here:

    http://www.haskell.org/ghc/docs/7.6.3/html/users_guide/compiler-plugins.html

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
http://www.mega-nerd.com/

_______________________________________________
ghc-devs mailing list
ghc-devs@haskell.org
http://www.haskell.org/mailman/listinfo/ghc-devs