getting started with the glasgow haskell compiler

Keith Wansbrough
Thu, 09 Aug 2001 10:37:04 +0100

Mikael Johansson writes:

> module Main (main) where
> main =3D putStrLn "Hello World"
> end
> =

> with the command
> =

> ghc Hello.lhs
> =

> I get the message on standard output:
> =

> No definitions in file <perhaps you forgot the '>'s?>

=2Elhs means "literate Haskell file".  Try

> module Main (main) where
> main =3D putStrLn "Hello World"

(the "end" isn't legal Haskell).  The ">" at the beginning of the line ar=
e called "Bird tracks" (after Richard Bird), and mark the lines of a lite=
rate Haskell program that are actually code.  Lines without them are just=

Or try

module Main (main) where
main =3D putStrLn "Hello World"

which is another way of marking code.

The final way, probably the easiest, is simply to put your program in a f=
ile called Hello.hs  rather than Hello.lhs.  The .hs extension means "ord=
inary Haskell code".


--KW 8-)
-- =

Keith Wansbrough <>
Cambridge University Computer Laboratory.