Prelude/main magicks?

Tomasz Zielonka t.zielonka at students.mimuw.edu.pl
Sun May 9 22:45:32 EDT 2004


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


More information about the Glasgow-haskell-users mailing list