CONTENT="Modular DocBook HTML Stylesheet Version 1.64
GHCi is invoked with the command ghci or ghc ––interactive. One or more modules or filenames can also be specified on the command line; this instructs GHCi to load the specified modules or filenames (and all the modules they depend on), just as if you had said :load modules at the GHCi prompt (see Section 3.6). For example, to start GHCi and load the program whose topmost module is in the file Main.hs, we could say:
Most of the command-line options accepted by GHC (see Chapter 4) also make sense in interactive mode. The ones that don't make sense are mostly obvious; for example, GHCi doesn't generate interface files, so options related to interface file generation won't have any effect.
GHCi can make use of all the packages that come with GHC, For example, to start up GHCi with the network package loaded:
Note that GHCi will also automatically load any packages on which the requested package depends.
The following command works to load new packages into a running GHCi:
But note that doing this will cause all currently loaded modules to be unloaded, and you'll be dumped back into the Prelude.
Extra libraries may be specified on the command line using the normal -llib option. For example, to load the “m” library:
On systems with .so-style shared libraries, the actual library loaded will the liblib.so. GHCi searches the following places for libraries, in this order:
On systems with .dll-style shared libraries, the actual library loaded will be lib.dll. Again, GHCi will signal an error if it can't find the library.
GHCi can also load plain object files (.o or .obj depending on your platform) from the command-line. Just add the name the object file to the command line.