You can learn Haskell in interactive mode by using Ghci command. Open terminal and type ‘ghci’, it opens window like below. (GHC stands for Glasgow Haskell Compiler, in GHCi I stands for interactive). From GHCi prompt you can evaluate expression, load Haskel files, reload Haskell files, get the type of expression, variables etc.,
$ ghci
GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help
Prelude>
Observe above snippet, it is telling that I am using ghci version 7.10.3. You can evaluate any kind of Haskell expressions in interactive mode.
Prelude> 2 + 3 + 5 + 7
17
Prelude> 2 - 3 * 8
-22
Prelude> 18/23.45678
0.76736875223283
As you observe, by default, prompt is opened using Preclude>, Prelude is a library which is loaded by default. You can change this by using the statement ‘:set prompt "hari>"’.
Prelude> :set prompt "hari>"
hari>10+20
30
hari>(20 + 30)*12.34
617.0
This post first appeared on Java Tutorial : Blog To Learn Java Programming, please read the originial post: here