Do something with TypecheckedSource during build?

Simon Marlow marlowsd at
Fri Mar 2 16:10:15 CET 2012

On 02/03/2012 10:48, JP Moresmau wrote:
> Hello,
> I know that in 7.4 I can add a Core transformation plugin, but I
> didn't find in the doc if there was a way to do what I'd like to. I
> don't really want to go as far as Core, I think. What I do at the
> moment is that I use the GHC API to get to the point where I have a
> TypedcheckedSource and then dump information about it in a file. I was
> wondering if I could do the same thing by plugging "something" into
> GHC via the command line. So I could do ghc --make test.hs -c
> -fsourceplugin=myplugin, and my plugin would be given the
> TypecheckedSource. That means I could do my transformation directly my
> calling Cabal and not have to worry about launching the GHC API with
> all the proper flags, but without even actually generating something.
> Is what I want achievable with today's tools or shall I stick to using the API?

We don't have a way of doing that from the command line I'm afraid.  It 
wouldn't be hard to add though - just look at how core-to-core plugins 
are done.


More information about the Glasgow-haskell-users mailing list