A simple project has the following files included in it:
➜ helloworld ls
LICENSE Setup.hs helloworld.cabal src stack.yaml
In the folder src
there is a file named Main.hs
. This is the "starting point" of the helloworld
project. By default Main.hs
contains a simple "Hello, World!" program.
Main.hs
module Main where
main :: IO ()
main = do
putStrLn "hello world"
Make sure you are in the directory helloworld
and run:
stack build # Compile the program
stack exec helloworld # Run the program
# prints "hello world"