n_broberg at hotmail.com
Sun May 9 21:24:55 EDT 2004
> > I am currently co-developing a language as an extension to Haskell,
> > means of a preprocessor to GHC. In this language we want to supply the
> > programmer with a number of functions by default, as with the functions
> > the GHC Prelude.
> > Is there some simple way to make GHC treat our own base library in the
> > magic way as the Prelude, so that it is always implicitly available?
>Perhaps your preprocessor could just place a suitable 'import' in the
>generated Haskell module?
Indeed, and that is precisely what we are doing right now. And it's not
really all that much work for us either, but I can envision other uses for
such a feature as well, so my question still stands.
> > And while I'm asking about magicks; In our language we have a special
> > function, called "page", that we require be present in "executable"
> > modules, much like a main-function. Once again, is there some way of
> > tweaking GHC to check this for us?
>Along the same lines: put something like this in the generated module
> requirePage :: ()
> requirePage = f page
> f :: PageType -> ()
> f _ = ()
Hmm, this is an interesting idea. I see a problem though, since (just like
with main) we don't require just all modules to contain such a function,
only the "executable" ones. That would correspond to the one that we invoke
ghc (with the preprocessor) on, but ghc in turn will invoke the preprocessor
on all modules that are loaded. In other terms, ghc can know which module is
the first, but the preprocessor has no idea.
Thanks for the input,
Help STOP SPAM with the new MSN 8 and get 2 months FREE*
More information about the Glasgow-haskell-users