Saturday, July 30, 2011

Haskell_Notes_4

Using the GHC Compiler:

1. Create a file - baby.hs

2.  Open the WinGHCi

ghc> :cd D:\2011\Learning_Workspace\2011_Learnings\Haskell_Learnings

ghci>  :load "baby.hs"  ------loads the module.


  1. doubleSmallNumber x = if x > 100  
  2.                         then x  
  3.                         else x*2   


Haskell - if should always have else. both parts if & else  should return expression.

Functions - Rules


1. Cannot begin with Uppercase letter.
2. Name can be conanO'Brien = "It's a-me, Conan O'Brien!"   
3. When a function doesn't take any parameters, we usually say it's a definition (or a name).

No comments:

Post a Comment