Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Introduction to GHCi

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: :? for help

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
Prelude> 2 - 3 * 8
Prelude> 18/23.45678

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>(20 + 30)*12.34

This post first appeared on Java Tutorial : Blog To Learn Java Programming, please read the originial post: here

Share the post

Introduction to GHCi


Subscribe to Java Tutorial : Blog To Learn Java Programming

Get updates delivered right to your inbox!

Thank you for your subscription