Doing this imports the module <tt>GHC</tt> from the package <tt>ghc</tt>, which comes with GHC 6.5 and subsequent. The module GHC exports the "GHC API", which is still in a state of flux. Currently it's not even Haddock-documented. You can see the source code (which is somewhat documented) here

Doing this imports the module <tt>GHC</tt> from the package <tt>ghc</tt>, which comes with GHC 6.5 and subsequent. The module GHC exports the "GHC API", which is still in a state of flux. Currently it's not even Haddock-documented. You can see the source code (which is somewhat documented) here

−

http://darcs.haskell.org/ghc/ghc/compiler/main/GHC.hs

+

http://darcs.haskell.org/ghc/compiler/main/GHC.hs

Here's an example main program that does it [[Media:Main.hs]]. To compile [[Media:Main.hs]], you have to turn on the flag "-package ghc", e.g.

Here's an example main program that does it [[Media:Main.hs]]. To compile [[Media:Main.hs]], you have to turn on the flag "-package ghc", e.g.

Revision as of 23:33, 26 April 2006

1 Using GHC as a library

In GHC 6.5 and subsequently you can import GHC as a Haskell library, which lets you write a Haskell program that has access to all of GHC.

Doing this imports the module GHC from the package ghc, which comes with GHC 6.5 and subsequent. The module GHC exports the "GHC API", which is still in a state of flux. Currently it's not even Haddock-documented. You can see the source code (which is somewhat documented) here
http://darcs.haskell.org/ghc/compiler/main/GHC.hs

Here's an example main program that does it Media:Main.hs. To compile Media:Main.hs, you have to turn on the flag "-package ghc", e.g.