
Hello, fellow GHCees, I am currently co-developing a language[1] as an extension to Haskell, by 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 in the GHC Prelude. Is there some simple way to make GHC treat our own base library in the same magic way as the Prelude, so that it is always implicitly available? Note that we don't want to exchange the existing Prelude for our own, we want to leave that one as it stands, rather we want one or more other libraries to be treated the same way as the Prelude. If the answer is no, that cannot be done, I would humbly request this as a feature in upcomming versions of GHC, I believe it's generally useful feature to have. =) 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? We cannot simply use a 'main-is' flag since this function is not executed the same way that a main function would be, and its type should not be IO (). I don't expect to be able to tell GHC what function must have what type with a command line flag, but is there some other way? Any leads are appreciated, even if they only lead into the source code of GHC... /Niklas Broberg [1] Haskell Server Pages: http://www.dtek.chalmers.se/~d00nibro/hsp/ _________________________________________________________________ The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail

On Sun, May 09, 2004 at 06:54:27PM +0000, Niklas Broberg wrote:
I am currently co-developing a language[1] as an extension to Haskell, by 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 in the GHC Prelude. Is there some simple way to make GHC treat our own base library in the same 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?
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 where f :: PageType -> () f _ = () IIRC if you use a name beginning with underscore, GHC won't warn that it is unused. Best regards, Tom -- .signature: Too many levels of symbolic links
participants (2)
-
Niklas Broberg
-
Tomasz Zielonka