Lesson 2. Functions and functional programming
Lesson 3. Lambda functions and lexical scope
Figure 3.1. The simple function rewritten as a lambda function
Figure 3.2. How sumSquareOrSquareSum works using a lambda function
Figure 3.3. The sumSquareOrSquareSum function rewritten to use a let expression
Lesson 5. Closures and partial application
Figure 5.1. The genIfEven function lets you build ifEvenX functions simply.
Figure 5.2. ifEvenInc with closure
Figure 5.4. Capturing the host value in a closure
Lesson 6. Lists
Figure 6.1. A list is made up of the head element and the tail list.
Lesson 7. Rules for recursion and pattern matching
Figure 7.1. Visualizing pattern-matching internals for myHead
Lesson 8. Writing recursive functions
Lesson 9. Higher-order functions
Lesson 10. Capstone: Functional object-oriented programming with robots!
Figure 10.1. Method-calling approach to OOP
Figure 10.2. Message-passing approach to OOP (commonly used in functional programming languages)
Lesson 11. Type basics
Figure 11.1. Type signature for a variable
Figure 11.2. Defining the double function by using a type signature
Figure 11.3. Type signature for multi-argument functions and definition makeAddress
Figure 11.4. Desugaring the multi-argument makeAddress into a sequence of single-argument functions
Figure 11.5. Visualizing type variables taking on actual values
Lesson 12. Creating your own types
Figure 12.1. Defining the Sex type
Figure 12.2. Combining ABOType and RhType to create BloodType
Lesson 13. Type classes
Lesson 14. Using type classes
Lesson 15. Capstone: Secret messages!
Figure 15.1. The best way to visualize ROT13 is as a decoder ring.
Lesson 17. Design by composition—Semigroups and Monoids
Lesson 18. Parameterized types
Figure 18.1. Definition of the Box parameterized type
Figure 18.2. The definition of a List
Lesson 20. Capstone: Time series
Figure 20.1. An example of time-series data for sales
Figure 20.2. Combining two time series
Figure 20.3. Visualizing the diff function
Figure 20.4. Sales time series with diff applied
Figure 20.5. Sales time-series with a moving average of 12 applied
Lesson 21. Hello World!—introducing IO types
Figure 21.1. Treating an IO String like a regular String using do-notation
Lesson 24. Working with files
Figure 24.1. The problem with closing a file before we use it when using lazy evaluation
Lesson 25. Working with binary data
Figure 25.1. A scene from Michael Betancourt’s glitch art video “Kodak Moment” (2013)
Figure 25.2. The target of your glitching is the lovecraft.jpg image.
Figure 25.3. The underwhelming effect of changing a single byte
Figure 25.4. A much more interesting result, achieved with randomSortSection
Figure 25.5. Now your beloved author looks more like a resident of Innsmouth!
Lesson 26. Capstone: Processing binary files and book data
Figure 26.1. Your book data rendered as HTML
Figure 26.2. The content of a raw MARC record
Figure 26.3. Annotated version of the MARC record
Lesson 27. The Functor type class
Lesson 28. A peek at the Applicative type class: using functions in a context
Figure 28.1. The signature of the function you need to connect your locationsDB with printDistance
Figure 28.2. Annotated type signature for Functor’s only method, fmap
Figure 28.4. Annotated type signature for the <*> operator
Figure 28.5. Combining <$> with <*> to compute haversine in a Maybe context
Lesson 29. Lists as context: a deeper look at the Applicative type class
Figure 29.2. Type class definition for Applicative
Figure 29.5. Nondeterministic computing computes on all possible paths, rather than just one.
Lesson 30. Introducing the Monad type class
Figure 30.1. A visualization of the mismatch between function and context that Functor solves
Figure 30.2. Applicative's <*> solves the problem of functions themselves being in a context.
Figure 30.3. Applicative’s pure method means you can always put a result into a context.
Figure 30.5. Functor is a superclass of Applicative, which is a superclass of Monad.
Figure 30.7. Using a lambda expression with return to transform a type a -> a into a -> m a
Lesson 31. Making Monads easier with do-notation
Lesson 32. The list monad and list comprehensions
Figure 32.1. Generating lists by thinking of List as a Monad
Figure 32.2. List comprehensions simplify do-notation even further for generating lists.
Lesson 33. Capstone: SQL-like queries in Haskell
Figure 33.1. The relationships among the basic data you’ll be working with
Figure 33.2. The type signature of your select function
Figure 33.3. The type signature for your where function
Figure 33.4. Reading the type signature for _join
Figure 33.5. The _join function joins two data sets on matching properties.
Lesson 37. Capstone: Building a prime-number library
Lesson 38. Errors in Haskell and the Either type
Figure 38.1. How can you solve the case of calling head on an empty list?
Lesson 40. Working with JSON data by using Aeson
Figure 40.1. An example of JSON data from the Google Analytics API
Lesson 41. Using databases in Haskell
Lesson 42. Efficient, stateful arrays in Haskell
Figure 42.1. The STUArray is a context that allows for stateful mutations.
Figure 42.2. Unlike IO, you can take values out of the STUArray context.