module Main where main = putStrLn "Hello world!"
so I typed in ghci:
--make -o hello Main.hs
but when I want to run it with
./hello I get a parse error for
I tried also
ghc --make -o hello Main.hs but then I get an "Variable not in scope: ghc" error.
Can somebody tell me, what I'm doing wrong?
Short answer: You do not compile the program in the
It looks like you are running this in
ghci(based on the error message
Variable not in scope).
ghciis a Haskell shell, but you do not write commands to compile or run a program in the Haskell shell itself. You run these in a shell like
So you open a terminal window, and then you can
cdto the correct directory where the
Main.hsfile is located, then you can write:
or for a Windows system, you can add a
and finally you can run this program, for example by writing
./helloin the shell.