Skip to content

Commit 51249bf

Browse files
author
Gregory Cox
committed
Change double quotes in HTML text to curved double quote characters
1 parent 5e065a3 commit 51249bf

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

docs/functors-applicative-functors-and-monoids.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ <h1>Functors, Applicative Functors and Monoids</h1>
233233
fmap (\x y z -&gt; x + y / z) [3,4,5,6] :: (Fractional a) =&gt; [a -&gt; a -&gt; a]
234234
</pre>
235235
<p>If we map <span class="fixed">compare</span>, which has a type of <span class="fixed">(Ord a) =&gt; a -&gt; a -&gt; Ordering</span> over a list of characters, we get a list of functions of type <span class="fixed">Char -&gt; Ordering</span>, because the function <span class="fixed">compare</span> gets partially applied with the characters in the list. It’s not a list of <span class="fixed">(Ord a) =&gt; a -&gt; Ordering</span> function, because the first <span class="fixed">a</span> that got applied was a <span class="fixed">Char</span> and so the second <span class="fixed">a</span> has to decide to be of type <span class="fixed">Char</span>.</p>
236-
<p>We see how by mapping "multi-parameter" functions over functors, we get functors that contain functions inside them. So now what can we do with them? Well for one, we can map functions that take these functions as parameters over them, because whatever is inside a functor will be given to the function that we’re mapping over it as a parameter.</p>
236+
<p>We see how by mapping multi-parameter functions over functors, we get functors that contain functions inside them. So now what can we do with them? Well for one, we can map functions that take these functions as parameters over them, because whatever is inside a functor will be given to the function that we’re mapping over it as a parameter.</p>
237237
<pre name="code" class="haskell:hs">
238238
ghci&gt; let a = fmap (*) [1,2,3,4]
239239
ghci&gt; :t a

docs/input-and-output.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ <h1>Input and Output</h1>
353353
<p>Don’t think of a function like <span class="fixed">putStrLn</span> as a function that takes a string and prints it to the screen. Think of it as a function that takes a string and returns an I/O action. That I/O action will, when performed, print beautiful poetry to your terminal.</p>
354354
<a name="files-and-streams"></a><h2>Files and streams</h2>
355355
<img src="assets/images/input-and-output/streams.png" alt="streams" class="right" width="464" height="322">
356-
<p><span class="fixed">getChar</span> is an I/O action that reads a single character from the terminal. <span class="fixed">getLine</span> is an I/O action that reads a line from the terminal. These two are pretty straightforward and most programming languages have some functions or statements that are parallel to them. But now, let’s meet <span class="label function">getContents</span>. <span class="fixed">getContents</span> is an I/O action that reads everything from the standard input until it encounters an end-of-file character. Its type is <span class="fixed">getContents :: IO String</span>. What’s cool about <span class="fixed">getContents</span> is that it does lazy I/O. When we do <span class="fixed">foo &lt;- getContents</span>, it doesn’t read all of the input at once, store it in memory and then bind it to <span class="fixed">foo</span>. No, it’s lazy! It’ll say: <i>"Yeah yeah, I’ll read the input from the terminal later as we go along, when you really need it!"</i>. </p>
356+
<p><span class="fixed">getChar</span> is an I/O action that reads a single character from the terminal. <span class="fixed">getLine</span> is an I/O action that reads a line from the terminal. These two are pretty straightforward and most programming languages have some functions or statements that are parallel to them. But now, let’s meet <span class="label function">getContents</span>. <span class="fixed">getContents</span> is an I/O action that reads everything from the standard input until it encounters an end-of-file character. Its type is <span class="fixed">getContents :: IO String</span>. What’s cool about <span class="fixed">getContents</span> is that it does lazy I/O. When we do <span class="fixed">foo &lt;- getContents</span>, it doesn’t read all of the input at once, store it in memory and then bind it to <span class="fixed">foo</span>. No, it’s lazy! It’ll say: <i>Yeah yeah, I’ll read the input from the terminal later as we go along, when you really need it!</i>. </p>
357357
<p><span class="fixed">getContents</span> is really useful when we’re piping the output from one program into the input of our program. In case you don’t know how piping works in unix-y systems, here’s a quick primer. Let’s make a text file that contains the following little haiku:</p>
358358
<pre name="code" class="plain">
359359
I'm a lil' teapot
@@ -386,7 +386,7 @@ <h1>Input and Output</h1>
386386
IT'S SO SMALL, TASTELESS
387387
capslocker &lt;stdin&gt;: hGetLine: end of file
388388
</pre>
389-
<p>As you can see, piping the output of one program (in our case that was <i>cat</i>) to the input of another (<i>capslocker</i>) is done with the <span class="fixed">|</span> character. What we’ve done is pretty much equivalent to just running <i>capslocker</i>, typing our haiku at the terminal and then issuing an end-of-file character (that’s usually done by pressing Ctrl-D). It’s like running <i>cat haiku.txt</i> and saying: &ldquo;Wait, don’t print this out to the terminal, tell it to <i>capslocker</i> instead!&rdquo;.</p>
389+
<p>As you can see, piping the output of one program (in our case that was <i>cat</i>) to the input of another (<i>capslocker</i>) is done with the <span class="fixed">|</span> character. What we’ve done is pretty much equivalent to just running <i>capslocker</i>, typing our haiku at the terminal and then issuing an end-of-file character (that’s usually done by pressing Ctrl-D). It’s like running <i>cat haiku.txt</i> and saying: Wait, don’t print this out to the terminal, tell it to <i>capslocker</i> instead!.</p>
390390
<p>So what we’re essentially doing with that use of <span class="fixed">forever</span> is taking the input and transforming it into some output. That’s why we can use <span class="fixed">getContents</span> to make our program even shorter and better:</p>
391391
<pre name="code" class="haskell:hs">
392392
import Data.Char
@@ -410,7 +410,7 @@ <h1>Input and Output</h1>
410410
lets go
411411
LETS GO
412412
</pre>
413-
<p>We got out of that by pressing Ctrl-D. Pretty nice! As you can see, it prints out our capslocked input back to us line by line. When the result of <span class="fixed">getContents</span> is bound to <span class="fixed">contents</span>, it’s not represented in memory as a real string, but more like a promise that it will produce the string eventually. When we map <span class="fixed">toUpper</span> over <span class="fixed">contents</span>, that’s also a promise to map that function over the eventual contents. And finally when <span class="fixed">putStr</span> happens, it says to the previous promise: <i>"Hey, I need a capslocked line!"</i>. It doesn’t have any lines yet, so it says to <span class="fixed">contents</span>: <i>"Hey, how about actually getting a line from the terminal?"</i>. So that’s when <span class="fixed">getContents</span> actually reads from the terminal and gives a line to the code that asked it to produce something tangible. That code then maps <span class="fixed">toUpper</span> over that line and gives it to <span class="fixed">putStr</span>, which prints it. And then, <span class="fixed">putStr</span> says: <i>"Hey, I need the next line, come on!"</i> and this repeats until there’s no more input, which is signified by an end-of-file character.</p>
413+
<p>We got out of that by pressing Ctrl-D. Pretty nice! As you can see, it prints out our capslocked input back to us line by line. When the result of <span class="fixed">getContents</span> is bound to <span class="fixed">contents</span>, it’s not represented in memory as a real string, but more like a promise that it will produce the string eventually. When we map <span class="fixed">toUpper</span> over <span class="fixed">contents</span>, that’s also a promise to map that function over the eventual contents. And finally when <span class="fixed">putStr</span> happens, it says to the previous promise: <i>“Hey, I need a capslocked line!”</i>. It doesn’t have any lines yet, so it says to <span class="fixed">contents</span>: <i>“Hey, how about actually getting a line from the terminal?”</i>. So that’s when <span class="fixed">getContents</span> actually reads from the terminal and gives a line to the code that asked it to produce something tangible. That code then maps <span class="fixed">toUpper</span> over that line and gives it to <span class="fixed">putStr</span>, which prints it. And then, <span class="fixed">putStr</span> says: <i>“Hey, I need the next line, come on!”</i> and this repeats until there’s no more input, which is signified by an end-of-file character.</p>
414414
<p>Let’s make program that takes some input and prints out only those lines that are shorter than 10 characters. Observe:</p>
415415
<pre name="code" class="haskell:hs">
416416
main = do

docs/introduction.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ <h2>About this tutorial</h2>
4747
The channel #haskell on the Libera.Chat network is a great place to ask questions if you’re feeling stuck. People there are extremely nice, patient and understanding to newbies.
4848
</p>
4949
<p>
50-
I failed to learn Haskell approximately 2 times before finally grasping it because it all just seemed too weird to me and I didn’t get it. But then once it just "clicked" and after getting over that initial hurdle, it was pretty much smooth sailing. I guess what I’m trying to say is: Haskell is great and if you’re interested in programming you should really learn it even if it seems weird at first. Learning Haskell is much like learning to program for the first time — it’s fun! It forces you to think differently, which brings us to the next section …
50+
I failed to learn Haskell approximately 2 times before finally grasping it because it all just seemed too weird to me and I didn’t get it. But then once it just clicked and after getting over that initial hurdle, it was pretty much smooth sailing. I guess what I’m trying to say is: Haskell is great and if you’re interested in programming you should really learn it even if it seems weird at first. Learning Haskell is much like learning to program for the first time — it’s fun! It forces you to think differently, which brings us to the next section …
5151
</p>
5252

5353
<a name="so-whats-haskell"></a><h2>So what’s Haskell?</h2>
@@ -58,7 +58,7 @@ <h2>About this tutorial</h2>
5858
</p>
5959
<p>
6060
<img src="assets/images/introduction/lazy.png" class="right" alt="lazy" width="240" height="209">
61-
Haskell is <em>lazy</em>. That means that unless specifically told otherwise, Haskell won’t execute functions and calculate things until it’s really forced to show you a result. That goes well with referential transparency and it allows you to think of programs as a series of <em>transformations on data</em>. It also allows cool things such as infinite data structures. Say you have an immutable list of numbers <span class="fixed">xs = [1,2,3,4,5,6,7,8]</span> and a function <span class="fixed">doubleMe</span> which multiplies every element by 2 and then returns a new list. If we wanted to multiply our list by 8 in an imperative language and did <span class="fixed">doubleMe(doubleMe(doubleMe(xs)))</span>, it would probably pass through the list once and make a copy and then return it. Then it would pass through the list another two times and return the result. In a lazy language, calling <span class="fixed">doubleMe</span> on a list without forcing it to show you the result ends up in the program sort of telling you "Yeah yeah, I’ll do it later!". But once you want to see the result, the first <span class="fixed">doubleMe</span> tells the second one it wants the result, now! The second one says that to the third one and the third one reluctantly gives back a doubled 1, which is a 2. The second one receives that and gives back 4 to the first one. The first one sees that and tells you the first element is 8. So it only does one pass through the list and only when you really need it. That way when you want something from a lazy language you can just take some initial data and efficiently transform and mend it so it resembles what you want at the end.
61+
Haskell is <em>lazy</em>. That means that unless specifically told otherwise, Haskell won’t execute functions and calculate things until it’s really forced to show you a result. That goes well with referential transparency and it allows you to think of programs as a series of <em>transformations on data</em>. It also allows cool things such as infinite data structures. Say you have an immutable list of numbers <span class="fixed">xs = [1,2,3,4,5,6,7,8]</span> and a function <span class="fixed">doubleMe</span> which multiplies every element by 2 and then returns a new list. If we wanted to multiply our list by 8 in an imperative language and did <span class="fixed">doubleMe(doubleMe(doubleMe(xs)))</span>, it would probably pass through the list once and make a copy and then return it. Then it would pass through the list another two times and return the result. In a lazy language, calling <span class="fixed">doubleMe</span> on a list without forcing it to show you the result ends up in the program sort of telling you “Yeah yeah, I’ll do it later!”. But once you want to see the result, the first <span class="fixed">doubleMe</span> tells the second one it wants the result, now! The second one says that to the third one and the third one reluctantly gives back a doubled 1, which is a 2. The second one receives that and gives back 4 to the first one. The first one sees that and tells you the first element is 8. So it only does one pass through the list and only when you really need it. That way when you want something from a lazy language you can just take some initial data and efficiently transform and mend it so it resembles what you want at the end.
6262
</p>
6363
<p>
6464
<img src="assets/images/introduction/boat.png" class="right" alt="boat" width="160" height="153">

docs/modules.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ <h1>Modules</h1>
328328
ghci&gt; unwords [&quot;hey&quot;,&quot;there&quot;,&quot;mate&quot;]
329329
&quot;hey there mate&quot;
330330
</pre>
331-
<p>We’ve already mentioned <span class="label function">nub</span>. It takes a list and weeds out the duplicate elements, returning a list whose every element is a unique snowflake! The function does have a kind of strange name. It turns out that "nub" means a small lump or essential part of something. In my opinion, they should use real words for function names instead of old-people words.</p>
331+
<p>We’ve already mentioned <span class="label function">nub</span>. It takes a list and weeds out the duplicate elements, returning a list whose every element is a unique snowflake! The function does have a kind of strange name. It turns out that nub means a small lump or essential part of something. In my opinion, they should use real words for function names instead of old-people words.</p>
332332
<pre name="code" class="haskell:ghci">
333333
ghci&gt; nub [1,2,3,4,3,2,1,2,3,4,3,2,1]
334334
[1,2,3,4]

docs/starting-out.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ <h1 style="margin-left:-3px">Starting Out</h1>
365365
<a name="texas-ranges"></a><h2>Texas ranges</h2>
366366
<p>
367367
<img src="assets/images/starting-out/cowboy.png" alt="draw" class="right" width="200" height="258">
368-
What if we want a list of all numbers between 1 and 20? Sure, we could just type them all out but obviously that’s not a solution for gentlemen who demand excellence from their programming languages. Instead, we’ll use ranges. Ranges are a way of making lists that are arithmetic sequences of elements that can be enumerated. Numbers can be enumerated. One, two, three, four, etc. Characters can also be enumerated. The alphabet is an enumeration of characters from A to Z. Names can’t be enumerated. What comes after "John"? I don’t know.
368+
What if we want a list of all numbers between 1 and 20? Sure, we could just type them all out but obviously that’s not a solution for gentlemen who demand excellence from their programming languages. Instead, we’ll use ranges. Ranges are a way of making lists that are arithmetic sequences of elements that can be enumerated. Numbers can be enumerated. One, two, three, four, etc. Characters can also be enumerated. The alphabet is an enumeration of characters from A to Z. Names can’t be enumerated. What comes after John? I don’t know.
369369
</p>
370370
<p>To make a list containing all the natural numbers from 1 to 20, you just write <span class="fixed">[1..20]</span>. That is the equivalent of writing <span class="fixed">[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]</span> and there’s no difference between writing one or the other except that writing out long enumeration sequences manually is stupid.</p>
371371
<pre name="code" class="haskell: ghci">

0 commit comments

Comments
 (0)