Home

GHCi

GHCi, short for the Glasgow Haskell Compiler interactive environment, is the interactive Read-Eval-Print-Loop (REPL) provided with the Glasgow Haskell Compiler (GHC). It offers a fast, incremental way to develop, test, and explore Haskell code by evaluating expressions, loading modules, and inspecting types without an explicit compilation step.

As a Haskell interpreter built on the GHC backend, GHCi compiles and runs code on demand. It

Common commands include :set to adjust options, :module to change the active module, and :! to run

Starting and using GHCi is straightforward: run ghci at the command line, optionally with a file to

maintains
a
session
that
keeps
definitions
loaded
in
memory,
so
later
expressions
can
reference
earlier
ones.
Users
can
query
types
with
commands
such
as
:type
or
:t,
inspect
available
names
with
:info
or
:browse,
and
inspect
typeclasses.
The
:load
or
:reload
commands
load
or
reload
modules
from
source
files.
external
shell
commands.
Expressions
entered
at
the
prompt
are
evaluated
lazily,
consistent
with
Haskell
semantics,
and
results
are
printed
to
the
console.
GHCi
can
also
run
simple
IO
actions
and
test
functions
interactively.
preload
(for
example,
ghci
MyModule.hs).
Once
loaded,
users
interact
with
the
prompt
and
progressively
build
and
test
code.
GHCi
is
widely
used
for
experimentation,
debugging,
learning,
and
rapid
prototyping,
and
remains
a
core
tool
for
Haskell
development
alongside
compiled
builds.