In GHCi, there appear to be two ways to include installed modules:
Prelude> :module Database.HDBC
Prelude Database.HDBC>
and
Prelude> import Database.HDBC
Prelude Database.HDBC>
Is there any difference between these? If not, why the duplicate commands?
I've always used import
, and now am noticing :module
used in Real World Haskell's databases chapter.
From the GHCi docs:
The
:module
command provides a way to do two things that cannot be done with ordinaryimport
declarations:
:module
supports the*
modifier on modules, which opens the full top-level scope of a module, rather than just its exports.- Imports can be removed from the context, using the syntax
:module -M
. Theimport
syntax is cumulative (as in a Haskell module), so this is the only way to subtract from the scope.