: Alejandro Serrano Mena
: Beginning Haskell A Project-Based Approach
: Apress
: 9781430262510
: 1
: CHF 47.10
:
: Programmiersprachen
: English
: 409
: Wasserzeichen/DRM
: PC/MAC/eReader/Tablet
: PDF

Beginning Haskell provides a broad-based introduction to the Haskell language, its libraries and environment, and to the functional programming paradigm that is fast growing in importance in the software industry. The book takes a project-based approach to learning the language that is unified around the building of a web-based storefront. Excellent coverage is given to the Haskell ecosystem and supporting tools. These include the Cabal build tool for managing projects and modules, the HUnit and QuickCheck tools for software testing, the Scotty framework for developing web applications, Persistent and Esqueleto for database access, and also parallel and distributed programming libraries.

Functional programming is gathering momentum, allowing programmers to express themselves in a more concise way, reducing boilerplate and increasing the safety of code. Indeed, mainstream languages such as C# and Java are adopting features from functional programming, and from languages implementing that paradigm. Haskell is an elegant and noise-free pure functional language with a long history, having a huge number of library contributors and an active community. This makes Haskell the best tool for both learning and applying functional programming, and Beginning Haskell the perfect book to show off the language and what it can do.

  • Takes you through a series of projects showing the different parts of the language.
  • Provides an overview of the most important libraries and tools in the Haskell ecosystem.
  • Teaches you how to apply functional patterns in real-world scenarios.


Alejandro Serrano Mena is working towards his PhD thesis inthe Software Technology group in Utrecht University. He is passionate forfunctional programming, and has been coding Haskell for personal andprofessional projects for more than five years. During his college years he wasactive in an association promoting functional languages among students, givingtalks and helping programmers get started in the functional paradigm. In 2011he took part in the Google Summer of Code program, enhancing the Haskellplug-in for the popular development environment Eclipse. His current positioninvolves research for enhancing the way in which developers get feedback andinteract with strong type systems such as Haskell's.
Contents at a Glance3
Contents397
About the Author407
About the Technical Reviewer408
Acknowledgments409
Introduction5
Part 1: First Steps6
Chapter 1: Going Functional7
Why Haskell?7
Why Pure Functional Programming?8
Why Strong Static Typing?9
The Haskell Ecosystem10
The History of Haskell10
Your Working Environment10
Installing on Windows11
Installing on Mac OS X11
Installing on Linux12
Installing on Linux from Source12
Checking That the Installation Is Successful13
Installing EclipseFP13
Taking Your First Steps with GHCi15
The Time Machine Store16
Summary17
Chapter 2: Declaring the Data Model18
Working with Characters, Numbers, and Lists18
Characters18
Numbers20
Strings21
Lists21
List Operations22
Creating a New Project25
Creating a Project from the Command Line25
Creating a Project from EclipseFP25
Understanding Modules28
Defining Simple Functions29
Creating a Simple Function29
Specifying the Function s Type30
Developing a Robust Example30
Returning More Than One Value32
Working with Data Types33
Pattern Matching36
Simple Patterns36
Lists and Tuples40
Guards41
View Patterns43
Records44
Creation and Use44
The Default Values Idiom46
Summary48
Chapter 3: Reusing Code Through Lists49
Parametric Polymorphism49
Functions As Parameters52
Higher-Order Functions52
Anonymous Functions54
Partial Application of a Function56
More on Modules59
Module Imports59
Smart Constructors and Views61
Diving into Lists63
Folds63
Lists and Predicates66
Lists Containing Tuples71
List Comprehensions72
Haskell Origami75
Summary78
Chapter 4: Using Containers and Type Classes79
Using Packages79
Managing Packages with Cabal and EclipseFP79
Sandboxed Environments84
Containers: Maps, Sets, Trees, Graphs86
Maps86
Sets89
Trees91
Graphs92
Obtaining Help94
Ad Hoc Polymorphism: Type Classes96
Declaring Classes and Instances96
Built-in Type Classes99
Binary Tress for the Minimum Price103
Step 1: Simple Binary Trees103
Step 2: Polymorphic Binary Trees104
Step 3: Binary Trees with Monoidal Cache106
Container-Related Type Classes108
Functors108
Foldables109
Summary111
Chapter 5: Laziness and Infinite Structures112
An Infinite Number of Time Machines1