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

Setting up Haskell in your machine

Step 1: Download Haskell from following location.
https://www.haskell.org/platform/

Step 2: Run the installer

Step 3: You have to add the Haskell bin directory path to your system path.  If you are using Mac (or) any linux system, open terminal and type ‘ghci’ command, if you are using Windows, you should go to All Programs, then GHC; you will see Ghci in the list. When you run the command ghci, it opens window like below, starting with version of GHCi followed by Prelude prompt. Prelude is a standard library of GHCi, that provides very useful functions.

$ ghci
GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help
Prelude>


‘ghci’ command opens Haskell in interactive mode, you can use this interactive session for learning/experiment purpose.

Prelude> 1+2
3
Prelude> 1-2
-1
Prelude> 1/2
0.5
Prelude> 1*2
2


If you load other libraries, then Prelude prompt changes to new library.

Prelude> import Data.List
Prelude Data.List>


GHC (Glasgow Haskell Compiler) has following three core components.
Component
Description
ghc
Compiler generates native code.
ghci
It is an interactive interpreter and debugger.
runghc
It is a program used to Haskell programs as scripts.

Note
Prelude is the core library loaded by default in every Haskell program.



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

Share the post

Setting up Haskell in your machine

×

Subscribe to Java Tutorial : Blog To Learn Java Programming

Get updates delivered right to your inbox!

Thank you for your subscription

×