I am trying to learn Haskell from the beginning and was wondering what exactly is the difference between the two prompts (Haskell and Prelude) that are used in it. It may sound a very naive question and not to mention I tried searching for the answer before posting this question but couldn't find one (proper one). Thank you in advance.
Prelude is a module that contains a small set of standard definitions and is included automatically into all Haskell modules.
Introduction. GHCi is GHC's interactive environment, in which Haskell expressions can be interactively evaluated and programs can be interpreted.
Open a command window and navigate to the directory where you want to keep your Haskell source files. Run Haskell by typing ghci or ghci MyFile. hs. (The "i" in "GHCi" stands for "interactive", as opposed to compiling and producing an executable file.)
You can also quit by typing control-D at the prompt. Attempts to reload the current target set (see :load ) if any of the modules in the set, or any dependent module, has changed. Note that this may entail loading new modules, or dropping modules which are no longer indirectly required by the target.
Okay, if I'm understanding this correctly, you're wondering if there's a difference between
Prelude>
and
ghci>
as prompts after you've invoked GHCi from the command line.
If this is the case, then there is no real difference aside from preference. You can change the prompt to whatever you want to by using the command:
:set prompt "aglebargle> "
You can replace arglebargle>
with whatever you'd like.
The main advantage I see for the Prelude>
prompt is that it will update when you import modules. Prelude is the only module you have without any imports, which is why it's the prompt. E.g., if you, say, did import Control.Monad
, you'd get Prelude Control.Monad>
as a prompt.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With