LinuxCommandLibrary

ghci

Interactive REPL environment for Haskell

TLDR

Start interactive session
$ ghci
copy
Load a file
$ ghci [file.hs]
copy
Load module in session
$ :load [file.hs]
copy
Get type of expression
$ :type [expression]
copy
Reload current module
$ :reload
copy

SYNOPSIS

ghci [options] [files]

DESCRIPTION

ghci is the interactive environment for GHC (Glasgow Haskell Compiler). It provides a REPL for evaluating Haskell expressions, loading modules, and exploring types interactively.
GHCi supports all GHC language extensions and can compile modules on the fly. It provides introspection commands for examining types, kinds, and documentation. Tab completion and command history enhance usability.

PARAMETERS

FILES

Haskell files to load.
:load FILE
Load a module.
:reload
Reload current modules.
:type EXPR
Show expression type.
:info NAME
Show info about name.
:quit
Exit GHCi.
-i DIR
Add to import path.
--help
Display help information.

CONFIGURATION

~/.ghci

Startup file loaded when GHCi starts, containing default settings, imports, and custom commands.

CAVEATS

Some compiled code may behave differently in interpreter. Memory usage can grow with large expressions. Restart clears interpreter state.

HISTORY

GHCi was introduced with GHC 5.0 in 2001, providing interactive Haskell evaluation alongside the batch compiler.

SEE ALSO

ghc(1), ghcid(1), cabal(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard