List of Listings

 

Lesson 1. Getting started with Haskell

Listing 1.1. hello.hs a Hello World program

Listing 1.2. A messy version of first_prog.hs

Listing 1.3. Corrected toPart function

Listing 1.4. Defining the bodyPart and fromPart functions

Listing 1.5. Defining the createEmail function

Listing 1.6. Improved first_prog.hs with a cleaned-up main

Lesson 2. Functions and functional programming

Listing 2.1. Hidden state in function calls

Listing 2.2. Confusing behavior in standard libraries

Listing 2.3. Defining your first variable

Listing 2.4. Variables aren’t variable!

Listing 2.5. calcChange v.1

Listing 2.6. calcChange v.2

Lesson 3. Lambda functions and lexical scope

Listing 3.1. sumSquareOrSquareSum v.1

Listing 3.2. The overwrite function

Lesson 4. First-class functions

Listing 4.1. ifEvenInc

Listing 4.2. ifEvenDouble and ifEvenSquare

Listing 4.3. ifEven

Listing 4.4. names

Listing 4.5. compareLastNames

Listing 4.6. addressLetter v.1

Listing 4.7. sfOffice, nyOffice, renoOffice

Listing 4.8. getLocationFunction

Listing 4.9. addressLetter v.2

Lesson 5. Closures and partial application

Listing 5.1. ifEvenInc, ifEvenDouble, ifEvenSquare

Listing 5.2. getRequestUrl

Listing 5.3. exampleUrlBuilder v.1

Listing 5.4. genApiRequestBuilder

Listing 5.5. myExampleUrlBuilder v.1

Listing 5.6. exampleUrlBuilder v.2 and myExampleUrlBuilder v.2