- Whence come definitions
- Imports from packages
- Exposed and hidden packages
- The home package
- The target set
- Star imports
- The automatic star
- The state of GHCi
- Overview of commands
- Deferring type errors
We’ll next look at bringing a file or project into scope in a GHCi session, which we do primarily using the
In a Haskell source file, what’s in scope is determined entirely by the list of
import statements at the top of the module. We can type
import statements into the GHCi prompt too, but GHCi also gives us additional ways to bring code into scope. These features make the scope at the prompt flexible, dynamic, and consequently more complicated.
Overall, there are two routes by which things come into scope in GHCi: either you typed them in at the prompt, or they were imported. Understanding the latter is a little tricky, as there are several ways that imports can happen.
:unaddcommands that manipulate the target set;
:moduleto bring modules into and out of scope;
- Using the
-packageGHC option and
:set -packagewithin GHCi to expose hidden packages; and
*means before a module name.