GHCI stands for "Glasgow Haskell Compiler". This compiler is the go-to solution for compiling your Haskell code. It can be seen as the pendant to GCC, actually compiling your code to C under the hood. Here is quick tour of running, testing and building your code with GHCI.
Executing a hello-world file (main.hs):
main :: IO ()
main = putStrLn "Hello World"
When you saved your file, we can open it in GHCI like this:
Alternatively, you can start GHCI first, and then import your module main.hs:
No, your file won't execute right now - opening like this kind of loads your file into GHCI, so that you can now play around with it. To execute it, type "main" and press enter, and you should see the output.
If you change something in the file, and want to run it again with GHCI opened, run:
Compiling your Haskell file to an executeable:
Instead of compiling to run it, you can also use "runhaskell" to run your program instantly.
Getting the function signature of something:
---head :: [a] -> a
To quit GHCI: