Prelude/main magicks?

Simon Peyton-Jones simonpj at microsoft.com
Mon May 10 10:27:19 EDT 2004


| 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. =)

A -fprelude-is flag would certainly be implementable.  The questions are


a) Would it be desirable?  After all, there isn't much difference
between

	module Main where { ... }
	ghc -fprelude-is Foo Main.hs
and
	module Main where { import Foo ... }
	ghc Main.hs

And arguably the latter it better because the code is more
self-describing.

b) GHC has a myriad of flags. Every time we add one, even a simple one,
it costs us an hour or two, and (worse) potentially interacts with stuff
in the future.   Each one is "just one little flag" but they do add up!

I'd be interested to know if lots of people thought this particular one
was very important, though.

| 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?

This seems less widely applicable to me; I suggest you use the ideas
suggested by others in their replies.

Simon



More information about the Glasgow-haskell-users mailing list