LinuxCommandLibrary

ghci

The Glasgow Haskell Compiler's interactive environment.

TLDR

Start a REPL (interactive shell)

$ ghci
copy


Start a REPL and load the specified Haskell source file
$ ghci [source_file.hs]
copy


Start a REPL and enable a language option
$ ghci -X[language_option]
copy


Start a REPL and enable some level of compiler warnings (e.g. all or compact)
$ ghci -W[warning_level]
copy


Start a REPL with a colon-separated list of directories for finding source files
$ ghci -i[path/to/directory1]:[path/to/directory2]
copy

Help

Usage:

    ghci [command-line-options-and-input-files] 

The kinds of input files that can be given on the command-line 
include:

  - Haskell source files (.hs or .lhs suffix) 
  - Object files (.o suffix, or .obj on Windows) 
  - Dynamic libraries (.so suffix, or .dll on Windows) 

In addition, ghci accepts most of the command-line options that plain 
GHC does.  Some of the options that are commonly used are:

    -i

         Search for imported modules in the directory 

    -H32m     Increase GHC's default heap size to 32m 

    -cpp            Enable CPP processing of source files 

Full details can be found in the User's Guide, an online copy of which 
can be found here:

    http://www.haskell.org/ghc/docs/latest/html/users_guide/ 

If you *really* want to see every option, then you can pass 
'--show-options' to ghci. 

Copied to clipboard