Pro Skill (6) – Intro to Haskell

There are many popular functional programming languages, some of them are:
OCaml,
Erlang,
Clojure,
Scala,
Python and Haskell.

Haskell: purely functional programming language, which means functions in Haskell do not have side-effect.

  1. Pure function vs impure: i) it does not have any observable side-effects (like output to device, changing a mutable object) and, ii) it doesn’t change when passed the same parameter (random is impure, date() which returns current time is impure…) Lazy evaluation: avoids evaluation anything until the actual value is needed.
  2. Learn Haskell in 10 minutes
  3. Try haskell: try haskell online
  4. Haskell Wiki: Foundation of Haskell 
    1. Haskell has 2 popular implementations: Hugs – interpreter used for teaching. GHC (Glasgow): it compiles to native code, provides debugging tools, supports parallel execution. ghc (compiler), ghci (interpreter), runghc (run ghc as script).
  5. Syntax:
    1. /= (which is !=),
    2. numbers are not convertible to True and False,
    3. enumeration notation [1..10]
    4. concatenation  [3,1,3] ++ [3,7] -> [3,1,3,3,7]
    5. add   1 : [2,3] -> [1,2,3]
    6. text string is a list of individual characters
    7. x :: y –>  “the expression x has the type y
    8. :type x -> show type of x
    9. — lines beginning with “–” are comments.
Advertisements

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 )

Google+ photo

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

Connecting to %s