
On Wed, Feb 13, 2002 at 08:42:09AM -0800, Jeffrey R Lewis wrote:
The point about same support in all implementations is of course a good one. Thomas and I are the culprits who put here docs in hugs in the first place. However, it is just as easy to support here docs using a pre-processor. I have a medium sized project that uses here docs, and can be used under both hugs and ghc. With hugs, I use the builtin feature, of course. With GHC, we just use a pre-processor. This is a bit awkward with GHC 5.02 and earlier versions, but starting with 5.03, GHC now has a proper interface for hooking in a pre-processor (don't know the details, bug Sigbjorn says it's in there).
That would be -F/-pgmF/-optF (they're documented). OK, some Haskell extensions can be implemented using preprocessors. It's imperfect (errors in the output hard to trace back to the source, errors in the preprocessor hard to handle properly) but it's better than nothing. But what's the best way to manage this? Suppose you have several modules, some of which need no preprocessor, while others need to be preprocessed in different ways (ignoring multiple extensions -- too hard). I've been doing this by using different filename extensions to distinguish them, plus a patched version of Hugs that can be told what filename extensions to accept, plus a preprocessor that uses the filename extensions to decide what to do. (For example, .y files could be sent through happy.) An alternative might be options in the source files, though the new GHC options are static, so that's not supported.