Haskell Book Solutions
This documents my solution to Haskell programming from first principles Exercises. Chapters All You Need is Lambda Hello, Haskell! Strings Basic Datatypes Types Type Classes More Functional Patterns Recursion Lists Folding lists Algebraic datatypes Signaling adversity Building p…
Chapter 1: All You Need is Lambda
This note captures my solutions to exercises in Chapter 1: All You Need is Lambda of the book Haskell programming from first principles Intermission: Equivalence Exercises \(\lambda x y . x z\) is equivalent to (b) \(\lambda m n . m z.\) \(\lambda x y . x x y\) is equivalent to…
Chapter 2: Hello, Haskell!
This note captures my solutions to exercises in Chapter 2: Hello, Haskell! of the book Haskell programming from first principles Exercises: Comprehension check comprehensionCheck.hs Exercises: Parentheses and association 8 + 7 * 9 is not the same as (8 + 7) * 9. arentheses chang…
Chapter 3: Strings
This note captures my solutions to exercises in Chapter 3: Strings of the book Haskell programming from first principles Exercises: Scope Question 1 Prelude> let x = 5 Prelude> let y = 7 Prelude> let z = x * y y is in scope for z. Question 2 Prelude> let f = 3 Prelud…
Chapter 4: Basic Datatypes
This note captures my solutions to exercises in Chapter 4: Basic Datatypes of the book Haskell programming from first principles Exercises: Mood swing The type constructor is Mood. If the function requires a Mood value, we can only use Blah or Woot. What is wrong with changeMood…
Chapter 5: Types
This note captures my solutions to exercises in Chapter 5: Types of the book Haskell programming from first principles Exercises: Type Matching The type signature for not is Bool -> Bool. The type signature for length is [a] -> Int. The type signature for concat is [[a]] -…