Haskell in Ubuntu 9.10

$ sudo apt-get install ghc6  //install

$ ghci //run Haskell

Prelude> putStrLn “Hello World”

Prelude> Hello World //printing into standard output

……………………..

Prelude> :quit //quit from Haskell compiler+interpreter

///////////////////////////////////

creating a Haskell file, compile , run (load)

$ vi File.hs //create haskell file with .hs extension

$ ghci //start Haskell

Prelude> :load File.hs

*Main> File 10 // running File with argument = 10

……… another way from shell without running ghci first …

//compile and generate executable output file named outFile,

//assumed File.hs is already been created with a “main”

$ ghc -o outFile File.hs

$ ./outFile // run the executable

//use  Tab for auto complete option for commands

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.