To run an Haskell program, you need to:
- Open the terminal
- Compile the program with
ghc -o <output name> <input name>
- Run the executable file with
./<output name>
You also need a
main
entrypoint
Of course this sounds super repetitive. In our case, we can use ghci
instead:
- Open the terminal
- Run
ghci
to open the interactive REPL - Import your module with
:load <module>.hs
(abbreviation::l <module>.hs
) - Call the function you want to run!
- If you have made edits, you can reload it with
:reload
(:r
)