Forrest logo
back to the ghci tool

ghc:tldr:ef70b

ghc: Start a REPL (interactive shell).
$ ghci
try on your machine

The command "ghci" stands for "GHCi" which stands for "Glasgow Haskell Compiler interactive". It is an interactive command line interface for executing Haskell code.

When you run the "ghci" command in your terminal, it starts the GHCi environment, which provides an interactive environment for Haskell development. It allows you to load Haskell files, define and test functions, and evaluate Haskell expressions.

Once you run the "ghci" command, you will see a prompt that looks like "Prelude>". This is the GHCi prompt, where you can type in Haskell code and see the results immediately.

For example, you can define a function like:

Prelude> let square x = x * x

You will see that GHCi accepts the function definition and assigns it to the name "square". You can then use the function by calling it with the desired arguments:

Prelude> square 5
25

GHCi also provides other features like type inference, tab completion, and the ability to load external Haskell modules. It is a powerful tool for exploring and experimenting with Haskell code.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the ghci tool