← 返回命令列表

Linux command

ghci 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Start interactive session

ghci

Load a file

ghci [file.hs]

Load module in session

:load [file.hs]

Get type of expression

:type [expression]

Reload current module

:reload

说明

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.

参数

: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.

FAQ

What is the ghci command used for?

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.

How do I run a basic ghci example?

Run `ghci` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does :load _FILE_ do in ghci?

Load a module.