Skip to content

Commit

Permalink
Typos Chapters 1, 2, 3 & 4 (kowainik#343)
Browse files Browse the repository at this point in the history
* Create ARPL @vrom911

Little intro.
==== DELETE THIS FILE ====

* Minor typos

* Small typos

* Typos (and small comment)

Pattern matching:
"The syntax of using pattern matching is similar to defining ordinary functions, but instead of using variable names, you use the values."
  and
"Note that you can pattern match on a variable too! Variable is like a pattern that matches any value and gives it a name. You can think of variables in function definitions as special cases of pattern matching."
==> Formulation is a little confusing.

* Small typos (and comment)

I like the quote you put in from Jasper Van der Jeugt. It was the typo in his name that prompted me to fork. : )
I had read through this tutorial and it was clear that many of the 'typos' had their origin in the fact that your native language is Russian. But I found that quite charming. : ) I did think that some of them might be a bit 'jarring' for some readers but so be it. However, it is never bad to make the experience 'smoother'.
Earlier I saw the keynote by Simon Peyton Jones at Scala eXchange 2020 and SPJ /also/ wrote his name wrong (different error though). Attributions are not difficult to get right.
But it must be something with Dutch/Flemish that the rest of the world finds difficult. I have stopped using my own name in international contexts for over 2 decades. You can call me whatever you like, but if you use my actual name I do appreciate it be written correctly. (Or pronounced correctly ... which my American wife still can't do ... so I changed my name to help her out. : )
Feel free to ignore/reject all my edits, but please keep the correction on Jasper's name. : )

* Minor typos

* Delete ARPL @vrom911
  • Loading branch information
ARPL-c-63h authored Nov 13, 2020
1 parent 44a2ed3 commit 543fa7f
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 68 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Starting to learn Haskell with Learn4Haskell is a piece of cake!

1. [Fork this repository](https://docs.github.com/en/free-pro-team@latest/github/getting-started-with-github/fork-a-repo).
2. :warning: Add the `hacktoberfest` topic to your fork. Otherwise, [your PRs won't count](https://hacktoberfest.digitalocean.com/hacktoberfest-update).
3. Enable GitHub Actions for your fork repository.
3. Enable GitHub Actions for your forked repository.
* Visit: https://github.com/<YOUR_GITHUB_USERNAME>/learn4haskell/actions
4. [Install the Haskell compiler](#installing-haskell).
5. Open the `src/Chapter1.hs` file, and start learning and solving tasks!
Expand All @@ -164,7 +164,7 @@ Starting to learn Haskell with Learn4Haskell is a piece of cake!
Learn4Haskell has 4 chapters that you can walk through and submit 4 pull requests to
complete the Hacktoberfest event (or just for knowledge and your enjoyment).

So, you can start right now with forking. Following this will describe how you can
So, you can start right now with forking. Following this we'll describe how you can
install all the necessary items to be able to run this course locally.

### Installing Haskell
Expand Down Expand Up @@ -207,7 +207,7 @@ in the corresponding chapters, run GHCi (Haskell interpreter, explained in the
course) from the root of this project and load your chapters to check your code.
Don't worry, each chapter explains all the needed information!

We also provide Makefile with commands to test your solutions locally with the included
We also provide a Makefile with commands to test your solutions locally with the included
prepared test-suite. We have also configured the CI using GitHub
Actions on Learn4Haskell to check your answers at GitHub automatically!

Expand Down
46 changes: 23 additions & 23 deletions src/Chapter1.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Here is how it works:
task proposed to consolidate the results.
★ Create a PR with solutions to as many tasks as you can after each Chapter is
finished.
★ Make sure that tests for the Chapter you are working at are passing.
★ Make sure that the tests for the Chapter you are working on are passing.
★ Receive some feedback and suggestions from us.
★ Merge the PR.
★ Go to the next Chapter.
Expand Down Expand Up @@ -95,9 +95,9 @@ work, and maybe produce a value of a different type.
Types can be _specific_ (like `Int`, `Integer`, `Double` or `Bool`) and they
always start with an uppercase letter, or _polymorphic_ (aka general) specified
through the variables – begin with the lowercase letter. The concept of
through the variables – begin with a lowercase letter. The concept of
polymorphism is more sophisticated than working with concrete types, thus we
won't dive too much into it in this chapter and will work with the concrete
won't dive too much into it in this chapter and will work with concrete
types for now.
Furthermore, Haskell is a __statically-typed__ language, which means that each
Expand All @@ -116,7 +116,7 @@ immediately see what types will be inferred.


{-
Haskell is a __compiled__ language. At the illustration below, you can see the
Haskell is a __compiled__ language. In the illustration below, you can see the
overall picture of the process from your code to the binary of the written
program:
Expand All @@ -127,7 +127,7 @@ program:
+-----------+ +-------------+ +-------------+
In comparison, such languages as Python, JavaScript, etc. are interpreted
languages. And that could be illustrated in the different workflow:
languages. And that could be illustrated in this different workflow:
+-----------+ +----------------+ +------------+
| | | | | |
Expand All @@ -140,7 +140,7 @@ run it later.
However, most of the time while working with Haskell (especially when learning
Haskell), you use __GHCi__ to play with functions, see their behaviour and
explore API of external libraries. GHCi is a __Haskell REPL__
explore the API of external libraries. GHCi is a __Haskell REPL__
(read-eval-print-loop). It allows calling functions directly in an interactive
shell. GHCi interprets Haskell expressions and statements and prints the
evaluation result of each expression.
Expand Down Expand Up @@ -190,7 +190,7 @@ ghci> :q
{- |
=⚔️= Task 1
Since types play a crucial role in Haskell, we can start by exploring types of
Since types play a crucial role in Haskell, we can start by exploring the types of
some basic expressions. You can inspect the type of expression by using the ":t"
command in GHCi (short for ":type").
Expand All @@ -203,7 +203,7 @@ False :: Bool
specified after these symbols.
So, the output in this example means that 'False' has type 'Bool'.
(ノ◕ヮ◕)ノ Your first task! Use GHCi to discover types of the following
(ノ◕ヮ◕)ノ Your first task! Use GHCi to discover the types of the following
expressions and functions:
> Try to guess first and then compare your expectations with GHCi output
Expand Down Expand Up @@ -252,7 +252,7 @@ exciting. Call to arms! In other words, let's call some functions.
When calling a function in Haskell, you type a name of the function first, and
then you specify space-separated function arguments. That's right. No commas, no
parenthesis. You only need to use () when grouping arguments (e.g. using other
parentheses. You only need to use () when grouping arguments (e.g. using other
expressions as arguments).
For example, if the function `foo` takes two arguments, the call of this
Expand All @@ -264,7 +264,7 @@ Operators in Haskell are also functions, and you can define your own operators
as well! The important difference between operators and functions is that
functions are specified using alphanumeric symbols, and operators are specified
using "operator" symbols. For example, addition — +, cons — :, list append — ++,
diamond operator — <>. Also, by default, you call operators in the __infix__
diamond operator — <>. Also, by default, you call operators in __infix__
form (operator goes __after__ the first argument), while ordinary functions are
what-called __prefix__ form (the name goes first, before all arguments).
Expand All @@ -284,7 +284,7 @@ ghci> 1 + 2
> It may look scary to you, but we will cover all this 'Num' and "=>" later. For
now, you can think of this as a polymorphic function — in this case, the
operator, that can work with any numeric types, including 'Int's, 'Double's,
operator, that can work with any numeric type, including 'Ints, 'Doubles,
etc. Or you can even pass the "+d" option to the ":t" command to see a simpler
type. In this case, polymorphic types will default to some standard types:
Expand All @@ -297,7 +297,7 @@ expressions in GHCi
> As in the previous task, try to guess first and then compare your expectations
with the GHCi output.
🕯 HINT: if you are curious, it might be interesting to explore types of
🕯 HINT: if you are curious, it might be interesting to explore the types of
functions and operators first. Remember this from the previous task? ;)
>>> 1 + 2
Expand Down Expand Up @@ -348,7 +348,7 @@ ghci> max True 'x'
ghci> 10 + True
This is a gentle way to get familiar with various error messages in Haskell.
In some cases, the error messages could be challenging to decipher and
In some cases, the error messages can be challenging to decipher and
understand their meaning. Haskell has a bad reputation for having not-so-helpful
error messages in some situations. But, of course, such a small challenge won't
stop you, right? You're a brave warrior, and you can finish all tasks despite
Expand All @@ -365,7 +365,7 @@ Let's now check how they are defined and whether we can introduce our own.
When defining a function in Haskell, you write its type signature on the first
line, and then its body on the following line(s). The type signature should be
written immediately from the start of a line. Haskell is __indentation-__ and
written immediately from the start of a line. Haskell is an __indentation-__ and
__layout-sensitive__ language, so this is important to keep in mind.
For example, here is the type signature of a function that takes a 'Double' and
Expand All @@ -380,7 +380,7 @@ GHCi. Now you know that this is the syntax for specifying types in your code as
well.
The following line should be the function definition start line. You write the
function name again and give argument names in the same order as you wrote types
function name again and give argument names in the same order as you wrote the types
followed by the "=" sign. And you provide the function implementation after "=".
@
Expand Down Expand Up @@ -422,7 +422,7 @@ Don't forget the main rule:
{- |
=⚔️= Task 3
Below you see the function that finds a square of the sum of two integers. Your
Below you see the function that finds the square of the sum of two integers. Your
task is to specify the type of this function.
>>> squareSum 3 4
Expand Down Expand Up @@ -507,13 +507,13 @@ Implement a function, that takes two numbers and returns the one closer to zero:
🕯 HINT: You can use the 'abs' function and the __if-then-else__ Haskell syntax
for this task.
'if-then-else' is a language construction for expression that returns only one
'if-then-else' is a language construct for an expression that returns only one
branch depending on the checked condition. For example:
>>> if even 10 then 0 else 1
0
The 'if-then-else' constructions must always have both __then__ and __else__
The 'if-then-else' constructs must always have both __then__ and __else__
branches because it is an expression and it must always return some value.
👩‍🔬 Due to lazy evaluation in Haskell, only the expression from the branch
Expand All @@ -531,7 +531,7 @@ Write a function that returns the middle number among three given numbers.
2
🕯 HINT: When checking multiple conditions, it is more convenient to use the
language construction called "guards" instead of multiple nested 'if-then-else'
language construct called "guards" instead of multiple nested 'if-then-else'
expressions. The syntax of guards is the following:
@
Expand All @@ -549,7 +549,7 @@ value after "=" where the condition is true.
♫ NOTE: The "=" sign goes after each branch, respectively.
♫ NOTE: It is essential to have the same indentation before each branch "|"!
Remember, that Haskell is indentation- and layout-sensitive language.
Remember, that Haskell is an indentation- and layout-sensitive language.
Casual reminder about adding top-level type signatures for all functions :)
-}
Expand Down Expand Up @@ -578,7 +578,7 @@ So far, we've been playing only with simple expressions and function
definitions. However, in some cases, expressions may become complicated, and it
could make sense to introduce some helper variables.
You can use the let-in construction in Haskell to define variables.
You can use the let-in construct in Haskell to define variables.
Here goes an example:
@
Expand All @@ -601,7 +601,7 @@ halfAndTwice n =
@
In addition to let-in (or sometimes even alternatively to let-in) you can use
the __where__ construction to define local variables and functions.
the __where__ construct to define local variables and functions.
And, again, the example:
@
Expand Down Expand Up @@ -657,7 +657,7 @@ firstDigit n = error "firstDigit: Not implemented!"


{-
You did it! Now it is time to open pull request with your changes
You did it! Now it is time to open a pull request with your changes
and summon @vrom911 and @chshersh for the review!
-}

Expand Down
26 changes: 13 additions & 13 deletions src/Chapter2.hs
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ elements is just [].
You probably noticed that lists could be of any type of
elements. Often you want to write a function that works with lists of
any types (but consistent inside one list). This feature is called
__parametric polymorphism__. It will be explained in more details
any type (but consistent inside one list). This feature is called
__parametric polymorphism__. It will be explained in more detail
later, but when working with lists, you often will see type signatures
like:
Expand All @@ -119,7 +119,7 @@ list with elements of the same type as the first list. Such words "a"
and "b" are called __type variables__.
For comparison, specific types in Haskell start with an uppercase
letter (Int, Bool, Char, etc.), when type variables begin with a
letter (Int, Bool, Char, etc.), where type variables begin with a
lowercase letter (a, b, el, etc.). This is the way to distinguish
between these types.
Expand Down Expand Up @@ -162,7 +162,7 @@ Take first N elements of a list:
>>> :t take
Create list from N same elements:
Create a list from N same elements:
>>> :t replicate
Expand All @@ -180,7 +180,7 @@ Join a list of strings with line breaks:
=⚔️= Task 2
To understand the list type better, it is also beneficial to play with
the list expressions in REPL.
list expressions in REPL.
Evaluate the following expressions in GHCi and insert the answers. Try
to guess first, what you will see.
Expand Down Expand Up @@ -269,7 +269,7 @@ For these reasons, adding elements to and extracting elements from the
beginning of a list is much cheaper and faster than working with the
end of the list.
In some sense, lists are similar to trains. Let's look at illustration
In some sense, lists are similar to trains. Let's look at an illustration
of a two-element list:
. . . . . o o o o o
Expand Down Expand Up @@ -325,7 +325,7 @@ Remember that each function returns a new list.
[]
♫ NOTE: When implementing, think about various corner cases. You
should return an empty list when given numbers are negative.
should return an empty list when given numbers that are negative.
And also don't forget to check the 'Data.List' module. It is full of
yummy functions.
Expand Down Expand Up @@ -405,7 +405,7 @@ always matches (the same as a variable), but we don't use its value.
of "=" only for the pattern that matches first. This is a helpful
thing to keep in mind, especially when you have overlapping patterns.
Also note that, if no pattern matches the value, the function fails
in runtime.
at runtime.
In addition to pattern matching in the function definition, you can
Expand Down Expand Up @@ -507,7 +507,7 @@ isThird42 = error "isThird42: Not implemented!"
{- |
=🛡= Recursion
Often, when writing in a functional style, you end up implementing the
Often, when writing in a functional style, you end up implementing
__recursive__ functions. Recursive functions are nothing more than
calling the function itself from the body of the same function.
Expand Down Expand Up @@ -611,7 +611,7 @@ duplicate = error "duplicate: Not implemented!"

{- |
=⚔️= Task 7
Write a function that takes elements of a list only on even positions.
Write a function that takes elements of a list only in even positions.
🕯 HINT: You need to write a recursive function that pattern matches
on the list structure. Your function will have several cases and
Expand Down Expand Up @@ -658,7 +658,7 @@ number 3 to each element of the list by introducing a lambda function:
>>> map (\x -> x + 3) [0..5]
[3,4,5,6,7,8]
The syntax of the lambda functions is somewhat similar to normal ones,
The syntax of lambda functions is somewhat similar to normal ones,
except for you don't need to think about its name, which is
awesome. To establish the start of the lambda function, you should
write "\" which is a bit similar to the lambda symbol — λ. Then you
Expand Down Expand Up @@ -719,7 +719,7 @@ Now you can see that there is nothing magic in HOFs in the end!
{- |
=⚔️= Task 8
Implement a function that repeats each element so many times as the
Implement a function that repeats each element as many times as the
value of the element itself
>>> smartReplicate [3, 1, 2]
Expand Down Expand Up @@ -796,7 +796,7 @@ Another unique Haskell feature is __lazy evaluation__. Haskell is lazy
by default, which means that it doesn't evaluate expressions when not
needed. The lazy evaluation has many benefits: avoid doing redundant
work, provide more composable interfaces. And in this section, we will
focus on Haskell ability to create infinite data structures and work
focus on Haskell's ability to create infinite data structures and work
with them!
For instance, the Haskell standard library has the 'repeat' function
Expand Down
Loading

0 comments on commit 543fa7f

Please sign in to comment.