From ac54d9883fd8f811e2fe2df3ffe115a864d9e3b5 Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Sun, 21 Dec 2025 22:31:15 -0800 Subject: [PATCH] Fix typos found by codespell --- .../source_md/functors-applicative-functors-and-monoids.md | 4 ++-- markdown/source_md/higher-order-functions.md | 2 +- markdown/source_md/input-and-output.md | 2 +- markdown/source_md/starting-out.md | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/markdown/source_md/functors-applicative-functors-and-monoids.md b/markdown/source_md/functors-applicative-functors-and-monoids.md index cef9b64..0f842f7 100644 --- a/markdown/source_md/functors-applicative-functors-and-monoids.md +++ b/markdown/source_md/functors-applicative-functors-and-monoids.md @@ -1047,7 +1047,7 @@ True It turns a list with the type `(Num a) => [a -> Bool]` into a function with the type `(Num a) => a -> [Bool]`. Pretty neat, huh? -Because lists are homogenous, all the functions in the list have to be functions of the same type, of course. +Because lists are homogeneous, all the functions in the list have to be functions of the same type, of course. You can't have a list like `[ord, (+3)]`, because `ord` takes a character and returns a number, whereas `(+3)` takes a number and returns a number. When used with `[]`, `sequenceA` takes a list of lists and returns a list of lists. @@ -1642,7 +1642,7 @@ instance Num a => Monoid (Product a) where `mappend` pattern matches on the `Product` constructor, multiplies the two numbers and then wraps the resulting number back. As you can see, there's a `Num a` class constraint. So this means that `Product a` is an instance of `Monoid` for all `a`'s that are already an instance of `Num`. -To use `Producta a` as a monoid, we have to do some *newtype* wrapping and unwrapping: +To use `Product a` as a monoid, we have to do some *newtype* wrapping and unwrapping: ```{.haskell:hs} ghci> getProduct $ Product 3 `mappend` Product 9 diff --git a/markdown/source_md/higher-order-functions.md b/markdown/source_md/higher-order-functions.md index 50f0251..a13fa6b 100644 --- a/markdown/source_md/higher-order-functions.md +++ b/markdown/source_md/higher-order-functions.md @@ -617,7 +617,7 @@ The lambda function `(\acc x -> acc + x)` is the same as `(+)`. We can omit the `xs` as the parameter because calling `foldl (+) 0` will return a function that takes a list. Generally, if you have a function like `foo a = bar b a`, you can rewrite it as `foo = bar b`, because of currying. -Anyhoo, let's implement another function with a left fold before moving on to right folds. +Anyhow, let's implement another function with a left fold before moving on to right folds. I'm sure you all know that `elem` checks whether a value is part of a list so I won't go into that again (whoops, just did!). Let's implement it with a left fold. diff --git a/markdown/source_md/input-and-output.md b/markdown/source_md/input-and-output.md index 130195a..da10528 100644 --- a/markdown/source_md/input-and-output.md +++ b/markdown/source_md/input-and-output.md @@ -2071,7 +2071,7 @@ Pure code can throw exceptions, but they can only be caught in the I/O part of o That's because you don't know when (or if) anything will be evaluated in pure code, because it is lazy and doesn't have a well-defined order of execution, whereas I/O code does. Earlier, we talked about how we should spend as little time as possible in the I/O part of our program. -The logic of our program should reside mostly within our pure functions, because their results are dependant only on the parameters that the functions are called with. +The logic of our program should reside mostly within our pure functions, because their results are dependent only on the parameters that the functions are called with. When dealing with pure functions, you only have to think about what a function returns, because it can't do anything else. This makes your life easier. Even though doing some logic in I/O is necessary (like opening files and the like), it should preferably be kept to a minimum. diff --git a/markdown/source_md/starting-out.md b/markdown/source_md/starting-out.md index 585bc5d..792385f 100644 --- a/markdown/source_md/starting-out.md +++ b/markdown/source_md/starting-out.md @@ -286,7 +286,7 @@ It's the most used data structure and it can be used in a multitude of different Lists are SO awesome. In this section we'll look at the basics of lists, strings (which are lists) and list comprehensions. -In Haskell, lists are a **homogenous** data structure. +In Haskell, lists are a **homogeneous** data structure. They store several elements of the same type. That means that we can have a list of integers or a list of characters but we can't have a list that has a few integers and then a few characters. And now, a list! @@ -771,7 +771,7 @@ That's its type and it doesn't matter if it has only one number in it or an infi Tuples, however, are used when you know exactly how many values you want to combine and its type depends on how many components it has and the types of the components. They are denoted with parentheses and their components are separated by commas. -Another key difference is that they don't have to be homogenous. +Another key difference is that they don't have to be homogeneous. Unlike a list, a tuple can contain a combination of several types. Think about how we'd represent a two-dimensional vector in Haskell.