[Haskell-cafe] using ghc as a library

Thomas Schilling nominolo at googlemail.com
Tue Oct 28 05:34:38 EDT 2008

GHC contains its own preprocessor, it just needs to be activated using
-cpp on the command line or {-# LANGUAGE CPP #-} inside the file.
However, I wasn't suggesting that.  I was suggesting that before you
hand the input to the ghc api, you substitute all occurences of import
"foo" by something that the haskell parser understands.

2008/10/28 Anatoly Yakovenko <aeyakovenko at gmail.com>:
> On Mon, Oct 27, 2008 at 3:23 PM, Thomas Schilling
> <nominolo at googlemail.com> wrote:
>> Not at the moment.  I was thinking about abstracting out the finder,
>> which might be useful for other things, too.  Can you maybe describe
>> your actual goal?  Adding an import "foo/bar" would not parse, so you
>> must have some kind of preprocessing going on, so you might be able to
>> insert some dummy imports there which you then have to provide.  E.g.:
>> import "foo/bar.hs" ~~> import CafeF00d.Foo.Bar, and you then copy (or
>> symlink) foo/bar.hs to CafeF00d/Foo/Bar.hs.  You can put those into a
>> special directory which you prepend to the list of searched
>> directories.
> Well my immediate goal was to see if i can make a generic build system
> ala ruby's rake or rant in haskell.  But the overall goal was to
> understand how the compiler works and what i can do with it.  I hate
> gui's so i prefer having a interface to my programs that's as
> expressive as the language that they are written in, and being
> typesafe is always nice :).
> I think you suggestion on using the preprocessor is an excellent idea,
> and should at least get me there.  Can you point me to some
> documentation on what gcc expects from the preprocessor?  Does it
> basically expect something that has the same interface as cpp?

More information about the Haskell-Cafe mailing list