LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

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, :t EXPR
Show expression type.
:kind, :k TYPE
Show the kind of a type.
:info NAME
Show info about name, including definition and instances.
:browse MODULE
List identifiers exported by a module.
:set OPTION
Set a GHCi or compiler option for the session.
:main ARGS
Run the program's `main` with the given arguments.
:quit, :q
Exit GHCi.
-i DIR1:...:DIRn
Add directories to the source file search path.
--help
Display help information.

CONFIGURATION

~/.ghci

Per-user startup file loaded when GHCi starts, containing default settings, imports, and custom commands.
./.ghci
Project-local startup file loaded after the user file (must have safe permissions to be read).

INSTALL

sudo apt install ghc
copy
sudo dnf install ghc
copy
sudo pacman -S ghc
copy
sudo apk add ghc
copy
sudo zypper install ghc
copy
brew install ghc
copy
nix profile install nixpkgs#ghc
copy

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), stack(1), runghc(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid