From cbaa0e66c690f78ad7bbe8091decef51ff8426e3 Mon Sep 17 00:00:00 2001 From: Guntbert Reiter Date: Fri, 4 Nov 2022 23:49:11 +0100 Subject: [PATCH 1/3] Fix a typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ba88824..0887f06 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Well, I began learning Haskell in 2021 at my undergrad studies and quickly came However, I quickly realised some parts are slowly becoming outdated as Haskell continues to evolve. That is why, with the author's blessing, I decided to create this open-source fork to enable the Haskell community to participate in preserving and maintaining this awesome resource for the future times. -Anyone is invited to **contribute** be either opening a pull request (preferred) or opening a content edit request (in the pipeline, open soon!) for proposed changes. +Anyone is invited to **contribute** by either opening a pull request (preferred) or opening a content edit request (in the pipeline, open soon!) for proposed changes. The whole thing is completely free to read online, but the original is also available in print and we encourage you to buy a copy! From c3a1dcdbded0c4f036c3bbd226d80da62406db7e Mon Sep 17 00:00:00 2001 From: Guntbert Reiter Date: Fri, 4 Nov 2022 23:59:59 +0100 Subject: [PATCH 2/3] Correct the sequence of parameters for intercalate According to `:t intercalate` the list comes first and the list of lists comes second. --- docs/modules.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/modules.html b/docs/modules.html index b43aeeb..23fde79 100644 --- a/docs/modules.html +++ b/docs/modules.html @@ -81,7 +81,7 @@

Modules

ghci> intersperse 0 [1,2,3,4,5,6] [1,0,2,0,3,0,4,0,5,0,6] -

intercalate takes a list of lists and a list. It then inserts that list in between all those lists and then flattens the result.

+

intercalate takes a list and a list of lists. It then inserts that list in between all those lists and then flattens the result.

 ghci> intercalate " " ["hey","there","guys"]
 "hey there guys"

From 3af2352d1ecbf351113f17ce7c6850f4efe7d865 Mon Sep 17 00:00:00 2001
From: Guntbert Reiter 
Date: Sat, 5 Nov 2022 00:27:09 +0100
Subject: [PATCH 3/3] Fix a typo

missing 'if'
---
 docs/modules.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/modules.html b/docs/modules.html
index 23fde79..c5f653d 100644
--- a/docs/modules.html
+++ b/docs/modules.html
@@ -276,7 +276,7 @@ 

Modules

find :: (a -> Bool) -> [a] -> Maybe a

Notice the type of find. Its result is Maybe a. That's kind of like having the type of [a], only a value of the type Maybe can contain either no elements or one element, whereas a list can contain no elements, one element or several elements.

-

Remember when we were searching for the first time our stock went over $1000. We did head (dropWhile (\(val,y,m,d) -> val < 1000) stock). Remember that head is not really safe. What would happen if our stock never went over $1000? Our application of dropWhile would return an empty list and getting the head of an empty list would result in an error. However, if we rewrote that as find (\(val,y,m,d) -> val > 1000) stock, we'd be much safer. If our stock never went over $1000 (so if no element satisfied the predicate), we'd get back a Nothing. But there was a valid answer in that list, we'd get, say, Just (1001.4,2008,9,4). +

Remember when we were searching for the first time our stock went over $1000. We did head (dropWhile (\(val,y,m,d) -> val < 1000) stock). Remember that head is not really safe. What would happen if our stock never went over $1000? Our application of dropWhile would return an empty list and getting the head of an empty list would result in an error. However, if we rewrote that as find (\(val,y,m,d) -> val > 1000) stock, we'd be much safer. If our stock never went over $1000 (so if no element satisfied the predicate), we'd get back a Nothing. But if there was a valid answer in that list, we'd get, say, Just (1001.4,2008,9,4).

elemIndex is kind of like elem, only it doesn't return a boolean value. It maybe returns the index of the element we're looking for. If that element isn't in our list, it returns a Nothing.

 ghci> :t elemIndex