Home > front end >  ghci vs prelude Haskell
ghci vs prelude Haskell

Time:11-03

I have recently started learning Haskell and had some questions about ghci> prompt vs prelude> prompt?

When typing ghci i get this:

ghci
GHCi, version 9.2.4: https://www.haskell.org/ghc/  :? for help
ghci>

when checking documentation I see things like this:

 $ ghci
    GHCi, version 6.12.3: http://www.haskell.org/ghc/  :? for help
    Loading package base ... linking ... done.
    Prelude>

also in addition to this I do not get into a module once I've loaded it

ghci> :load main
[1 of 1] Compiling Main             ( main.hs, interpreted )
Ok, one module loaded.
ghci>   

should look something like this?

ghci> :load main
[1 of 1] Compiling Main             ( main.hs, interpreted )
Ok, one module loaded.
*Main>   

I have tried looking online, tried compiling the program

CodePudding user response:

GHCi is less verbose since version 9.0. This is because after a while the list of modules became very long, making the shell less effective.

Therefore since version 9.0, it keeps showing the ghci> prompt by default. You can set the prompt with %s> [ghc-doc] to show the loaded modules instead:

ghci> :set prompt "%s> "
Prelude> import Data.List
Prelude Data.List>

CodePudding user response:

This was changed in GHC 9.0.1. Earlier versions showed the modules that were loaded, but now it just shows ghci>.

See the release notes for GHC 9.0.1:

2.1.2.3. GHCi

  • GHCi prompt no longer lists loaded modules. The previous behavior can be restored with :set prompt "%s> " and :set prompt-cont "%s| ".
  • Related