When it starts, unless the -ignore-dot-ghci flag is given, GHCi reads and executes commands from the following files, in this order, if they exist:
./.ghci
appdata/ghc/ghci.conf, where appdata depends on your system, but is usually something like C:/Documents and Settings/user/Application Data
On Unix: $HOME/.ghc/ghci.conf
$HOME/.ghci
The ghci.conf file is most useful for turning on favourite options (eg. :set +s), and defining useful macros. Placing a .ghci file in a directory with a Haskell project is a useful way to set certain project-wide options so you don't have to type them everytime you start GHCi: eg. if your project uses GHC extensions and CPP, and has source files in three subdirectories A, B and C, you might put the following lines in .ghci:
:set -fglasgow-exts -cpp :set -iA:B:C
(Note that strictly speaking the -i flag is a static one, but in fact it works to set it using :set like this. The changes won't take effect until the next :load, though.)
Once you have a library of GHCi macros, you may want to source them from separate files, or you may want to source your .ghci file into your running GHCi session while debugging it
:def source readFile
With this macro defined in your .ghci file, you can use :source file to read GHCi commands from file. You can find (and contribute!-) other suggestions for .ghci files on this Haskell wiki page: GHC/GHCi
Two command-line options control whether the startup files files are read: