Skip to content

13. Using GHC interactively

GHCi is the interactive GHC environment, a.k.a. the REPL. You could access it with command:

stack exec ghci

But that won't load up locally written modules for access. For that, use the stack ghci or stack repl commands, which are equivalent.

The stack ghci or stack repl command

To then load modules from your project in GHCi, use the :module command (:m for short) followed by the module name.

Note

If you have added packages to your project please make sure to mark them as extra-deps for faster and reliable usage of stack ghci. Otherwise GHCi may have trouble due to conflicts of compilation flags or having to unnecessarily interpret too many modules. See Stack's project-level configuration to learn how to configure a package as an extra-dep.

For further information, see the REPL environment documentation.