Main.main naming convention

Martin Norbäck d95mback@dtek.chalmers.se
10 Sep 2002 09:29:30 +0200


--=-95PSFqRBUO8NaxGy9yTz
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

tis 2002-09-10 klockan 01.22 skrev Manuel M T Chakravarty:
> Martin Norb=E4ck <d95mback@dtek.chalmers.se> wrote,
>=20
> > I have a question about the Main.main naming convention. Would it be a
> > good idea to lift the restriction and allow any module which exports a
> > function main :: IO () to be compiled into a separate binary?
> >=20
> > You'd need to specify which module should be the top-level module when
> > compiling, of course.
> >=20
> > Why I'm asking is because I have several Main modules in one directory,
> > in files like Program1.hs, Program2.hs and so on, but all of these
> > claims (and must claim) to be "module Main".
>=20
> So?  That just means that the file name of Program1.hs,
> Program2.hs, etc will be different from the name of the
> module that they contain.  I think all Haskell systems allow
> the Main module to be in a file whose name differs from the
> module name (in contrast to other modules, which need to be
> found when chasing imports).

Well, one reason is that I may very well want to import the module
containing main into another module. Another reason is that hdoc will
use the name in the module statement instead of the file name, and
rightly so, how is it to know what the module name should be, especially
if the module is in a directory in a hirarchical module space.

It's not a big thing, but I just wonder if there is a reason not to
allow any module containg main to be compiled into a program.

Regards,

	Martin


--=-95PSFqRBUO8NaxGy9yTz
Content-Type: application/pgp-signature; name=signature.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: För information se http://www.gnupg.org/

iD8DBQA9fZ9akXyAGj+oWAsRAiXOAJ0VXBO7qJZS2qZXchpSUYCvg0V6lACfSRoy
iZrrXyf7toJYuf6j0/EsLVw=
=zb4m
-----END PGP SIGNATURE-----

--=-95PSFqRBUO8NaxGy9yTz--