GHC Extensibility

Simon Peyton-Jones simonpj at
Wed May 30 12:51:31 EDT 2007

|  is there any plan to improve GHC's extensibility by providing a
| simpler way to integrante new backends?  I worked at Haskell.NET
| in GHC's code!  I haven't yet figured out how to call the .NET code
| generator from GHC 6.6.1's main function.  Further, it would be great
| if there was a better extensibility mechanism (such as a "plugin"
| infrastructure, for example)  in which it wasn't necessary to use
| "#ifdef"along the code.  Also, it would be very useful if this

Yes, good idea.  I think the Right Way to do this is by elaborating the GHC API.  At the moment it has a baked-in way of generating output files, but presumably by elaborating the interface one could allow either
a) GHC returns some Core, and you finish the job, or
b) you give to GHC a function to use for code generation

This requires design work on the GHC API.  As I remarked a couple of days ago, there's a chicken and egg problem with the GHC API.  We have not been working hard on the API because we don't have lots of evidence of strong demand. And since it doesn't do today what you want, you find another way round.

One good thing might be for someone to coordinate a set of use-cases. "We'd like to do X and Y and Z with the GHC API."  I'm thinking pretty specific stuff, with rough type signatures etc, not just "the GHC API should support .net" or "should support dynamic linking".    And names of the protagonists who can amplify.

Next, we'd want to do some API design: just what interface would be good for users?

None of this requires GHC HQ to be on the critical path -- and we know that putting us in the critical path slows processes down!   It'd be sensible for us to comment early and often on the practicality of various possible proposed APIs, and I think we can do that.  But we don't need to drive the process.

Does that sound interesting in principle?  i.e. are there half a dozen people who would like to use the GHC API if only it did X?  (Or did Y better.)  If so, would you like to get together and follow the sequence above?

I know that you all have day jobs too!  But I feel bad that we often no-op on good suggestions because there are Too Many Things To Do To GHC, so it makes sense to maximise opportunities for other people to play a leading role.


More information about the Glasgow-haskell-users mailing list