[Haskell-cafe] First steps in Haskell
wolfgang at jeltsch.net
Mon Dec 19 04:56:25 EST 2005
Am Sonntag, 18. Dezember 2005 17:42 schrieb Daniel Carrera:
> Lemmih wrote:
> > GHC is a compiler. If you want to compile to a binary then you must
> > define a function called 'main'. Otherwise just load the file in ghci
> > (`ghci fac.hs`).
> I would expect GHC to be able to compile a program with a function that
> is not called 'main'. I wouldn't expect it to print anything when run,
> but I would expect it to compile.
So you want a program that doesn't contain a main variable to be compiled into
an executable which does nothing? This doesn't seem to make much sense.
In addition, Haskells requirement of a main variable is nothing new. Take C,
C++, Java, PASCAL. They all require you to somehow specify a main
> `ghci fac.hs` doesn't give any errors. I don't understand why loading
> the file like that is ok but typing the entries is not.
Because the interactive environments are about evaluating expressions based on
declarations which were made in Haskell source files, not about creating new
declarations. Expressions and declarations are just two different things. I
think, Cale explained why it might be a bad idea to allow entering
declarations at the command line.
> This might be a problem for people exporing the language.
Hmm, don't know.
More information about the Haskell-Cafe