GHC plugin without registering the plugin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

GHC plugin without registering the plugin

Erik de Castro Lopo-34
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/


Reply | Threaded
Open this post in threaded view
|

GHC plugin without registering the plugin

Andrew Farmer
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 at 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 at haskell.org
> http://www.haskell.org/mailman/listinfo/ghc-devs
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20130505/157325e4/attachment.htm>

Reply | Threaded
Open this post in threaded view
|

GHC plugin without registering the plugin

kudah
Shouldn't it just work with
$GHC_PACKAGE_PATH or --package-db = dist/package.conf.inplace?

On Sun, 5 May 2013 14:31:20 -0700 Andrew Farmer <afarmer at ittc.ku.edu>
wrote:

> 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 at 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 at haskell.org
> > http://www.haskell.org/mailman/listinfo/ghc-devs
> >