In Haskell, after using Prelude to load some files
Prelude> :l xxxFileName
The prompt beomes
*Main> xxxx
I don't know where the "Main" function come from, as I didn't define any function called "Main". Is this a special status of Haskell's command line environment? How can I exit the "*Main" prompt context and come back to "Prelude>"?
Thanks.
That's a GHCi convention. By default, GHCi will show the name of the module you've loaded. An asterisk (
*
) indicates that you have access on all top-level bindings (definitions that aren't inside of other ones), and not the ones that are exported.If you didn't specify a module name in the file, GHCi will assume its name is
Main
:However, if you do specify a module name, GHCi will display that one instead:
To unload any additional modules, use
:m
, but keep in mind that you cannot use functions fromxxxFileName.hs
anymore. Note thatPrelude
is always loaded, unless you've started GHCi with-XNoImplicitPrelude
.