RFC: Compiler plugins for GHC (was: Release/git plans)

austin seipp as at hacks.yi.org
Sun Jan 23 01:31:58 CET 2011

(moved into g-h-u mainline to avoid cluttering discussion around new
GHC plans. Anybody who has comments on the plugins work is encouraged
to reply here, not there.)


Preemptive TL;DR: I don't quite know, but I'd be willing to work on it.

I seem to remember at the time Max originally did his work (2008,)
dynamic linking outside of the home-grown linker inside GHCi (a rather
ad-hoc, special-use linker) was not available for any platforms GHC
supported. I wouldn't know what windows support lacked at the time it
was initially written, and I'm not sure about the state of it now is
the main thing I'm getting at I suppose. I didn't know enough about
GHC at the time.

If my memory serves correctly, Clemens Fruhwirth initally wrote the
patches for dynamic linking as we know it for GHC in 2007, although
they were only for linux. Later on, Simon M and Duncan Coutts did the
remaining work to get it release-quality ready on linux sometime
around when the new build system for GHC hit. I seem to remember
Well-Typed LLC *also* doing work on also supporting that form of
dynamic linking on windows. As a feature it seems to touch several
parts of GHC for every supported platform, if it is to support the
use-cases we would expect (like writing DLL/shared objects, or also
having the compiler being able to dynamically link objects - like
plugins.) I can't for the life of me remember if any of this work went
into mainline GHC, or what the current state of dynamic linking on
windows is.

At this exact moment, I do not have a windows machine to test or
develop GHC HEAD on - although we're in luck, as I should have a local
windows instance to use as a personal machine within the week. I have
only tested the patch on Linux and OS X Snow Leopard against GHC HEAD
- I am honestly not even aware of what is necessary to build a
development version of GHC on windows. But, I would be more than
willing and happy to work on it and work with GHC HQ to support it if
you're a potential user. I wouldn't want to shaft Windows users

So, if anybody can point out how to get GHC development on windows up
and running, I think I can point myself in the right direction. I'll
be sure to get back to you on how things go, Neil.

On Sat, Jan 22, 2011 at 11:20 AM, Neil Mitchell <ndmitchell at gmail.com> wrote:
> Hi Austin,
> The compiler plugins work is a great, and I'd be a likely user. The
> original version wasn't supported on Windows, because GHC on Windows
> lacked various forms of dynamic linking. Does the current patch you've
> prepared work on Windows?
> Thanks, Neil
> On Sat, Jan 22, 2011 at 10:29 AM, Max Bolingbroke
> <batterseapower at hotmail.com> wrote:
>> On 21 January 2011 23:59, austin seipp <as at hacks.yi.org> wrote:
>>> Perhaps Max can
>>> elaborate on why this design was rejected in favor of the current one,
>>> so we can see how and where it falls down, and what we really want.
>> The only reason really is that it added a lot of mechanism. From the
>> top of my head:
>>  * Parsing etc for PHASE pragmas that declared phase objects
>>  * A new namespace for phases
>>  * Stuff to gather declared phases from all imported modules during compilation
>>  * A built-in phase for each core pass
>>  * A solver that ordered core passes and plugin passes according to the phases
>> So it was a lot of trouble for relatively little gain. In an effort to
>> keep the delta against GHC small I threw it out in favour of the much,
>> much simpler design we have today.
>>> Thomas pointed out the Scala compiler plugin design document, so I'll
>>> be sure to read over it this weekend when I get the chance to cook up
>>> ideas.
>> The Scala plugins project was just starting when I was working on GHC
>> plugins so there was no design doc I could refer to at that time.
>> Shame :-(
>> Thanks for taking the lead on resurrecting plugins, Austin!
>> Cheers,
>> Max
>> _______________________________________________
>> Glasgow-haskell-users mailing list
>> Glasgow-haskell-users at haskell.org
>> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



More information about the Glasgow-haskell-users mailing list