September 18, 2026

Haskell for Hobos -- GHCI

Type "ghci" at the command line and you are greeted with:
ghci>
At least you are with the current version (I am running 9.10.3). This is the Haskell interpreter and I rarely use it.

I am the exception though, or so it seems. I avoid it and edit files named "xyz.hs" and have a header in the file to launch runghc. This allows me to use vim to edit the files and "./xyz.hs" to run them. I can't bear to type some complex expression into ghci and either make typos or have to type it again (making typos the second time).

My other objection is that ghci has a slightly different flavor of Haskell -- as if you are working inside of do syntax all the time. I don't want to learn two sets of rules.

You can use ghci as a "Haskell debugger" and get around most of my objections by pulling existing files into ghci using:

:load xyz.hs
There is a coding style refered to as "REPL", which stands for
Read, Evaluate, Print, and Loop.
This is exactly what ghci supports. The REP steps are performed by ghci as it reads your input, evaluates it and prints results, then loops back to wait for more input. Some people find this productive.

Note that there are a number of colon prefixed commands like :load -- often shortened to one letter, that trigger special ghci features. %nav


Have any comments? Questions? Drop me a line!

Tom's software pages / tom@mmto.org