INTRODUCTION TO
HASKELL
Functional Programming CUCE211
Topics
• About Haskell
• Characteristics of Haskell
• Haskell Features
About Haskell
• Purely functional programming language.
• Functions are the primary citizens of Haskell.
• Promotes advantages of modular programming such as
ease of maintenance and debugging, scalability and
reuse.
• Defining characteristics guide how code should best be
written or how certain solutions should be designed.
Characteristics of Haskell
• Haskell is purely functional: You tell the computer what something IS, and not
what /how to do. For example, the product of 10 numbers is the first number
multiplied by the product of the remaining 9 numbers.
• Functions have no side-effects. Each function fulfils its obligation and returns a
result.
• Functions have referential transparency. Each function is consistent in the
results it produces for the same set of values.
• Immutability. Setting a variable to a certain value makes that variable constant.
• Modularisation. Bigger functions can be built by putting together several
functions.
• Lazy evaluation: functions are executed only when required by the user.
• Haskell deals well with infinite lists and infinite structures
Some Haskell Features
• Static typing
• Polymorphisms
• Type inference – Concrete types are deduced by the type
system where-ever it is obvious
• Layout-sensitivity
• ML (Meta Language) syntax
• Automatic currying
Some Haskell Features (1)
• Garbage collector - Garbage collection moves responsibility
for many memory issues from the developer into the
language's runtime,
• Green threads – Instead of requiring the developer to
manually deal with asynchronous (or non-blocking) I/O calls,
the runtime system takes responsibility for this
• Software Transactional Memory (STM) - An abstraction for
concurrent communication that increases
composability and modularity, where concurrent abstractions
can be easily composed with any other abstraction built using
STM, without exposing the details of how the abstraction
ensures safety.
Next
Let’s Explore Haskell