How to go back to prelude> in ghci
HaskellHaskell Problem Overview
When I :load
a Haskell script into GHCi, it changes the prompt from Prelude>
to *Main>
. After I'm done with this script, how can I go back to the Prelude>
prompt? There seems to be no documentation regarding this.
Haskell Solutions
Solution 1 - Haskell
Try using the :m
command. It should unload all the modules.
This is short for :module
which sets the current context. You can also load arbitrary modules this way:
Prelude> :m Data.List Control.Applicative
Prelude Data.List Control.Applicative> :m
Prelude>
Solution 2 - Haskell
Adding to the answer by @Tikhon Jelvis.
Apparently you can choose to unload modules using the syntax :m -<module>
. As in:
Prelude> import Numeric
Prelude Numeric> :m -Numeric
Prelude> :m +Numeric
Prelude Numeric>
Solution 3 - Haskell
You can
- Change directory via
:cd /new/directory
- Load another file/module. It causes the preceding module to unload.
See the definition of :cd/:load in https://downloads.haskell.org/~ghc/6.6/docs/html/users_guide/ghci-commands.html