Skip to content

Commit 1835e55

Browse files
author
Gregory Cox
committed
Add id attributes to heading tags that do not have them
1 parent c026914 commit 1835e55

16 files changed

+55
-55
lines changed

docs/a-fistful-of-monads.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</li>
3232
</ul>
3333
</div>
34-
<h1>A Fistful of Monads</h1>
34+
<h1 id="a-fistful-of-monads">A Fistful of Monads</h1>
3535

3636
<p>
3737
When we first talked about functors, we saw that they were a useful concept for
@@ -1682,7 +1682,7 @@ <h2 id="the-list-monad">The list monad</h2>
16821682
<span class="fixed">guard</span>.
16831683
</p>
16841684

1685-
<h3>A knight’s quest</h3>
1685+
<h3 id="a-knights-quest">A knight’s quest</h3>
16861686
<p>
16871687
Here’s a problem that really lends itself to being solved with non-determinism.
16881688
Say you have a chess board and only one knight piece on it. We want to find out
@@ -1864,7 +1864,7 @@ <h2 id="monad-laws">Monad laws</h2>
18641864
the if the laws hold. But don’t worry, they’re not complicated.
18651865
</p>
18661866

1867-
<h3>Left identity</h3>
1867+
<h3 id="left-identity">Left identity</h3>
18681868

18691869
<p>
18701870
The first monad law states that if we take a value, put it in a default
@@ -1925,7 +1925,7 @@ <h3>Left identity</h3>
19251925
<span class="fixed">IO</span> as well.
19261926
</p>
19271927

1928-
<h3>Right identity</h3>
1928+
<h3 id="right-identity">Right identity</h3>
19291929

19301930
<p>
19311931
The second law states that if we have a monadic value and we use
@@ -1983,7 +1983,7 @@ <h3>Right identity</h3>
19831983
value that it produced did a lot of other stuff.
19841984
</p>
19851985

1986-
<h3>Associativity</h3>
1986+
<h3 id="associativity">Associativity</h3>
19871987

19881988
<p>
19891989
The final monad law says that when we have a chain of monadic function

docs/chapters.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<body class="introcontent">
1717
<div class="bgwrapper">
1818
<div id="content">
19-
<h1>Learn You a Haskell for Great Good!</h1>
19+
<h1 id="learn-you-a-haskell-for-great-good">Learn You a Haskell for Great Good!</h1>
2020
<p>
2121
<ol class="chapters">
2222
<li>

docs/faq.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@
1616
<body class="introcontent">
1717
<div class="bgwrapper">
1818
<div id="content">
19-
<h1>FAQ</h1>
19+
<h1 id="faq">FAQ</h1>
2020
<img src="assets/images/faq/turtle.png" alt="turtle???" class="right" width="349" height="204">
21-
<h2>Can I put this tutorial on my site or change it or whatever?</h2>
21+
<h2 id="can-i-put-this-tutorial-on-my-site-or-change-it-or-whatever">Can I put this tutorial on my site or change it or whatever?</h2>
2222
<p>Sure, it’s licensed under a <a href="https://creativecommons.org/licenses/by-nc-sa/3.0/" rel="nofollow">creative commons</a> license, so you can share and change this, as long as you do it with a smile on your face and for non-commercial purposes.</p>
23-
<h2>Do you recommend any other Haskell reading material?</h2>
23+
<h2 id="do-you-recommend-any-other-haskell-reading-material">Do you recommend any other Haskell reading material?</h2>
2424
<p>There are loads of awesome tutorials out there, but I’d just like to point out how great <a href="http://book.realworldhaskell.org/read/" rel="nofollow">Real World Haskell</a> is. It’s really great. I feel it complements this tutorial nicely. This tutorial focuses mainly on using simple examples to ease beginners into learning Haskell, whereas Real World Haskell really shows you how to do useful stuff with it.</p>
2525
<p>Another great Haskell resource is <a href="https://tryhaskell.org" rel="nofollow">Try Haskell</a>, which allows you to try Haskell right in your browser and offers a rad interactive walkthrough.</p>
26-
<h2>How do I get in touch with you?</h2>
26+
<h2 id="how-do-i-get-in-touch-with-you">How do I get in touch with you?</h2>
2727
<p>The best way would be to shoot me an email to bonus at learnyouahaskell dot com. I kinda suck at email though, so please, please don’t be mad if I don’t reply in a timely fashion!</p>
28-
<h2>Your book is cool but I want some exercises too!</h2>
28+
<h2 id="your-book-is-cool-but-i-want-some-exercises-too">Your book is cool but I want some exercises too!</h2>
2929
<p>Coming soon! A lot of people have been asking me to add exercises, so I’ll be putting some up soonish.</p>
30-
<h2>Tell me about yourself!</h2>
30+
<h2 id="tell-me-about-yourself">Tell me about yourself!</h2>
3131
<p>My name is Miran Lipovača, I reside in Ljubljana, Slovenia. Most of my time is spent on doing nothing in particular, but when I’m not doing nothing I’m either programming, drawing, boxing or playing bass. I even have a cool <a href="https://www.bigbasstabs.com">bass tabs</a> site. I also have a collection of stuffed owls and sometimes I talk to them and they talk back.</p>
3232
<div class="footdiv">
3333
<ul>

docs/for-a-few-monads-more.html

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</li>
3232
</ul>
3333
</div>
34-
<h1>For a Few Monads More</h1>
34+
<h1 id="for-a-few-monads-more">For a Few Monads More</h1>
3535

3636
<img src="assets/images/for-a-few-monads-more/clint.png" alt="there are two kinds of people in the world, my friend. those who learn them a haskell and those who have the job of coding java" class="right" width="189" height="400">
3737

@@ -217,7 +217,7 @@ <h2 id="writer">Writer? I hardly know her!</h2>
217217
appending the logs.
218218
</p>
219219

220-
<h3>Monoids to the rescue</h3>
220+
<h3 id="monoids-to-the-rescue">Monoids to the rescue</h3>
221221

222222
<div class="hintbox">
223223
Be sure you know what <a href="functors-applicative-functors-and-monoids.html#monoids">monoids</a> are at this point! Cheers.
@@ -353,7 +353,7 @@ <h3>Monoids to the rescue</h3>
353353
<span class="fixed">("beer", Sum 65)</span>.
354354
</p>
355355

356-
<h3>The Writer type</h3>
356+
<h3 id="the-writer-type">The Writer type</h3>
357357

358358
<p>
359359
Now that we’ve seen that a value with an attached monoid acts like a monadic
@@ -455,7 +455,7 @@ <h3>The Writer type</h3>
455455
<span class="fixed">do</span> notation, <span class="fixed">error</span> is called.
456456
</p>
457457

458-
<h3>Using do notation with Writer</h3>
458+
<h3 id="using-do-notation-with-writer">Using do notation with Writer</h3>
459459

460460
<p>
461461
Now that we have a <span class="fixed">Monad</span> instance, we’re free to use
@@ -539,7 +539,7 @@ <h3>Using do notation with Writer</h3>
539539
(15,[&quot;Got number: 3&quot;,&quot;Got number: 5&quot;,&quot;Gonna multiply these two&quot;])
540540
</pre>
541541

542-
<h3>Adding logging to programs</h3>
542+
<h3 id="adding-logging-to-programs">Adding logging to programs</h3>
543543

544544
<p>
545545
Euclid’s algorithm is an algorithm that takes two numbers and computes their
@@ -677,7 +677,7 @@ <h3>Adding logging to programs</h3>
677677
<span class="fixed">do</span> expressions if it increases readability).
678678
</p>
679679

680-
<h3>Inefficient list construction</h3>
680+
<h3 id="inefficient-list-construction">Inefficient list construction</h3>
681681

682682
<p>
683683
When using the <span class="fixed">Writer</span> monad, you have to be careful
@@ -754,7 +754,7 @@ <h3>Inefficient list construction</h3>
754754
the left instead of to the right.
755755
</p>
756756

757-
<h3>Difference lists</h3>
757+
<h3 id="difference-lists">Difference lists</h3>
758758

759759
<img src="assets/images/for-a-few-monads-more/cactus.png" alt="cactuses" class="left" width="147" height="300">
760760

@@ -897,7 +897,7 @@ <h3>Difference lists</h3>
897897
finally print its entries to the screen.
898898
</p>
899899

900-
<h3>Comparing Performance</h3>
900+
<h3 id="comparing-performance">Comparing Performance</h3>
901901

902902
<p>
903903
To get a feel for just how much difference lists may improve your performance,
@@ -1223,7 +1223,7 @@ <h2 id="state">Tasteful stateful computations</h2>
12231223
from getting a result we also get a new state.
12241224
</p>
12251225

1226-
<h3>Stacks and stones</h3>
1226+
<h3 id="stacks-and-stones">Stacks and stones</h3>
12271227

12281228
<p>
12291229
Say we want to model operating a stack. You have a stack of things one on top
@@ -1323,7 +1323,7 @@ <h3>Stacks and stones</h3>
13231323
the state manually.
13241324
</p>
13251325

1326-
<h3>The State monad</h3>
1326+
<h3 id="the-state-monad">The State monad</h3>
13271327

13281328
<p>
13291329
The <span class="fixed">Control.Monad.State</span> module provides a
@@ -1574,7 +1574,7 @@ <h3>The State monad</h3>
15741574
different monads.
15751575
</p>
15761576

1577-
<h3>Randomness and the state monad</h3>
1577+
<h3 id="randomness-and-the-state-monad">Randomness and the state monad</h3>
15781578

15791579
<p>
15801580
At the beginning of this section, we saw how generating numbers can sometimes be
@@ -1819,7 +1819,7 @@ <h2 id="useful-monadic-functions">Some useful monadic functions</h2>
18191819
Let’s see what they are then!
18201820
</p>
18211821

1822-
<h3>liftM and friends</h3>
1822+
<h3 id="liftm-and-friends">liftM and friends</h3>
18231823

18241824
<img src="assets/images/for-a-few-monads-more/wolf.png" alt="im a cop too" class="right" width="394" height="222">
18251825

@@ -2044,7 +2044,7 @@ <h3>liftM and friends</h3>
20442044
and applicative functors use.
20452045
</p>
20462046

2047-
<h3>The join function</h3>
2047+
<h3 id="the-join-function">The join function</h3>
20482048

20492049
<p>
20502050
Here’s some food for thought: if the result of one monadic value is another
@@ -2210,7 +2210,7 @@ <h3>The join function</h3>
22102210
out how to implement <span class="fixed">&gt;&gt;=</span>.
22112211
</p>
22122212

2213-
<h3>filterM</h3>
2213+
<h3 id="filterm">filterM</h3>
22142214

22152215
<p>
22162216
The <span class="fixed">filter</span> function is pretty much the bread of
@@ -2383,7 +2383,7 @@ <h3>filterM</h3>
23832383
to be everything at once, it’s a bit easier.
23842384
</p>
23852385

2386-
<h3>foldM</h3>
2386+
<h3 id="foldm">foldM</h3>
23872387

23882388
<p>
23892389
The monadic counterpart to <span class="fixed">foldl</span> is
@@ -2466,7 +2466,7 @@ <h3>foldM</h3>
24662466
whatever you want as your fold goes along its way.
24672467
</p>
24682468

2469-
<h3>Making a safe RPN calculator</h3>
2469+
<h3 id="making-a-safe-rpn-calculator">Making a safe RPN calculator</h3>
24702470

24712471
<img src="assets/images/for-a-few-monads-more/miner.png" alt="i’ve found yellow!" class="left" width="280" height="396">
24722472

@@ -2656,7 +2656,7 @@ <h3>Making a safe RPN calculator</h3>
26562656
returns a <span class="fixed">Nothing</span>.
26572657
</p>
26582658

2659-
<h3>Composing monadic functions</h3>
2659+
<h3 id="composing-monadic-functions">Composing monadic functions</h3>
26602660

26612661
<p>
26622662
When we were learning about the monad laws, we said that the

docs/functionally-solving-problems.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</li>
3232
</ul>
3333
</div>
34-
<h1>Functionally Solving Problems</h1>
34+
<h1 id="functionally-solving-problems">Functionally Solving Problems</h1>
3535
<p>In this chapter, we’ll take a look at a few interesting problems and how to think functionally to solve them as elegantly as possible. We probably won’t be introducing any new concepts, we’ll just be flexing our newly acquired Haskell muscles and practicing our coding skills. Each section will present a different problem. First we’ll describe the problem, then we’ll try and find out what the best (or least worst) way of solving it is.</p>
3636
<h2 id="reverse-polish-notation-calculator">Reverse Polish notation calculator</h2>
3737
<p>Usually when we write mathematical expressions in school, we write them in an infix manner. For instance, we write <span class="fixed">10 - (4 + 3) * 2</span>. <span class="fixed">+</span>, <span class="fixed">*</span> and <span class="fixed">-</span> are infix operators, just like the infix functions we met in Haskell (<span class="fixed">+</span>, <span class="fixed">`elem`</span>, etc.). This makes it handy because we, as humans, can parse it easily in our minds by looking at such an expression. The downside to it is that we have to use parentheses to denote precedence.</p>

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</li>
3232
</ul>
3333
</div>
34-
<h1>Functors, Applicative Functors and Monoids</h1>
34+
<h1 id="functors-applicative-functors-and-monoids">Functors, Applicative Functors and Monoids</h1>
3535
<p>Haskell’s combination of purity, higher order functions, parameterized algebraic data types, and typeclasses allows us to implement polymorphism on a much higher level than possible in other languages. We don’t have to think about types belonging to a big hierarchy of types. Instead, we think about what the types can act like and then connect them with the appropriate typeclasses. An <span class="fixed">Int</span> can act like a lot of things. It can act like an equatable thing, like an ordered thing, like an enumerable thing, etc.</p>
3636
<p>Typeclasses are open, which means that we can define our own data type, think about what it can act like and connect it with the typeclasses that define its behaviors. Because of that and because of Haskell’s great type system that allows us to know a lot about a function just by knowing its type declaration, we can define typeclasses that define behavior that’s very general and abstract. We’ve met typeclasses that define operations for seeing if two things are equal or comparing two things by some ordering. Those are very abstract and elegant behaviors, but we just don’t think of them as anything very special because we’ve been dealing with them for most of our lives. We recently met functors, which are basically things that can be mapped over. That’s an example of a useful and yet still pretty abstract property that typeclasses can describe. In this chapter, we’ll take a closer look at functors, along with slightly stronger and more useful versions of functors called applicative functors. We’ll also take a look at monoids, which are sort of like socks.</p>
3737
<h2 id="functors-redux">Functors redux</h2>
@@ -735,7 +735,7 @@ <h2 id="the-newtype-keyword">The newtype keyword</h2>
735735
to the other.
736736
</p>
737737

738-
<h3>Using newtype to make type class instances</h3>
738+
<h3 id="using-newtype-to-make-type-class-instances">Using newtype to make type class instances</h3>
739739

740740
<p>
741741
Many times, we want to make our types instances of certain type classes, but the
@@ -837,7 +837,7 @@ <h3>Using newtype to make type class instances</h3>
837837
(&quot;gnillac nodnol&quot;,3)
838838
</pre>
839839

840-
<h3>On newtype laziness</h3>
840+
<h3 id="on-newtype-laziness">On newtype laziness</h3>
841841

842842
<p>
843843
We mentioned that <i>newtype</i> is usually faster than <i>data</i>. The
@@ -967,7 +967,7 @@ <h3>On newtype laziness</h3>
967967
direct conversion from one type to another.
968968
</p>
969969

970-
<h3><span class="fixed">type</span> vs. <span class="fixed">newtype</span> vs. <span class="fixed">data</span></h3>
970+
<h3 id="type-vs.-newtype-vs.-data"><span class="fixed">type</span> vs. <span class="fixed">newtype</span> vs. <span class="fixed">data</span></h3>
971971

972972
<p>
973973
At this point, you may be a bit confused about what exactly the difference
@@ -1261,7 +1261,7 @@ <h2 id="monoids">Monoids</h2>
12611261
as the programmer have to be careful that our instances do indeed obey them.
12621262
</p>
12631263

1264-
<h3>Lists are monoids</h3>
1264+
<h3 id="lists-are-monoids">Lists are monoids</h3>
12651265

12661266
<p>
12671267
Yes, lists are monoids! Like we’ve seen, the <span class="fixed">++</span>
@@ -1348,7 +1348,7 @@ <h3>Lists are monoids</h3>
13481348
multiplication, but it doesn’t hold for all (and indeed, most) monoids.
13491349
</p>
13501350

1351-
<h3><span class="fixed">Product</span> and <span class="fixed">Sum</span></h3>
1351+
<h3 id="product-and-sum"><span class="fixed">Product</span> and <span class="fixed">Sum</span></h3>
13521352

13531353
<p>
13541354
We already examined one way for numbers to be considered monoids. Just have the
@@ -1447,7 +1447,7 @@ <h3><span class="fixed">Product</span> and <span class="fixed">Sum</span></h3>
14471447
6
14481448
</pre>
14491449

1450-
<h3><span class="fixed">Any</span> and <span class="fixed">All</span></h3>
1450+
<h3 id="any-and-all"><span class="fixed">Any</span> and <span class="fixed">All</span></h3>
14511451

14521452
<p>
14531453
Another type which can act like a monoid in two distinct but equally valid ways
@@ -1554,7 +1554,7 @@ <h3><span class="fixed">Any</span> and <span class="fixed">All</span></h3>
15541554
if all of them are <span class="fixed">True</span>, respectively.
15551555
</p>
15561556

1557-
<h3>The <span class="fixed">Ordering</span> monoid</h3>
1557+
<h3 id="the-ordering-monoid">The <span class="fixed">Ordering</span> monoid</h3>
15581558

15591559
<p>
15601560
Hey, remember the <span class="fixed">Ordering</span> type? It’s used as the
@@ -1734,7 +1734,7 @@ <h3>The <span class="fixed">Ordering</span> monoid</h3>
17341734
order themselves, ranging from the most important to the least.
17351735
</p>
17361736

1737-
<h3><span class="fixed">Maybe</span> the monoid</h3>
1737+
<h3 id="maybe-the-monoid"><span class="fixed">Maybe</span> the monoid</h3>
17381738

17391739
<p>
17401740
Let’s take a look at the various ways that <span class="fixed">Maybe a</span>
@@ -1871,7 +1871,7 @@ <h3><span class="fixed">Maybe</span> the monoid</h3>
18711871
Just &quot;two&quot;
18721872
</pre>
18731873

1874-
<h3>Using monoids to fold data structures</h3>
1874+
<h3 id="using-monoids-to-fold-data-structures">Using monoids to fold data structures</h3>
18751875

18761876
<p>
18771877
One of the more interesting ways to put monoids to work is to make them help us

docs/higher-order-functions.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</li>
3232
</ul>
3333
</div>
34-
<h1 style="margin-left:-3px">Higher Order Functions</h1>
34+
<h1 style="margin-left:-3px" id="higher-order-functions">Higher Order Functions</h1>
3535
<img src="assets/images/higher-order-functions/sun.png" alt="sun" class="right" width="203" height="183">
3636
<p>Haskell functions can take functions as parameters and return functions as return values. A function that does either of those is called a higher order function. Higher order functions aren’t just a part of the Haskell experience, they pretty much are the Haskell experience. It turns out that if you want to define computations by defining what stuff <i>is</i> instead of defining steps that change some state and maybe looping them, higher order functions are indispensable. They’re a really powerful way of solving problems and thinking about programs.</p>
3737
<h2 id="curried-functions">Curried functions</h2>

docs/input-and-output.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</li>
3232
</ul>
3333
</div>
34-
<h1>Input and Output</h1>
34+
<h1 id="input-and-output">Input and Output</h1>
3535
<img src="assets/images/input-and-output/dognap.png" alt="poor dog" class="right" width="261" height="382">
3636
<p>We’ve mentioned that Haskell is a purely functional language. Whereas in imperative languages you usually get things done by giving the computer a series of steps to execute, functional programming is more of defining what stuff is. In Haskell, a function can’t change some state, like changing the contents of a variable (when a function changes state, we say that the function has <i>side-effects</i>). The only thing a function can do in Haskell is give us back some result based on the parameters we gave it. If a function is called two times with the same parameters, it has to return the same result. While this may seem a bit limiting when you’re coming from an imperative world, we’ve seen that it’s actually really cool. In an imperative language, you have no guarantee that a simple function that should just crunch some numbers won’t burn down your house, kidnap your dog and scratch your car with a potato while crunching those numbers. For instance, when we were making a binary search tree, we didn’t insert an element into a tree by modifying some tree in place. Our function for inserting into a binary search tree actually returned a new tree, because it can’t change the old one.</p>
3737
<p>While functions being unable to change state is good because it helps us reason about our programs, there’s one problem with that. If a function can’t change anything in the world, how is it supposed to tell us what it calculated? In order to tell us what it calculated, it has to change the state of an output device (usually the state of the screen), which then emits photons that travel to our brain and change the state of our mind, man.</p>

docs/introduction.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
</li>
3030
</ul>
3131
</div>
32-
<h1>Introduction</h1>
32+
<h1 id="introduction">Introduction</h1>
3333

3434
<h2 id="about-this-tutorial">About this tutorial</h2>
3535
<p>

docs/making-our-own-types-and-typeclasses.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</li>
3232
</ul>
3333
</div>
34-
<h1>Making Our Own Types and Typeclasses</h1>
34+
<h1 id="making-our-own-types-and-typeclasses">Making Our Own Types and Typeclasses</h1>
3535
<p>In the previous chapters, we covered some existing Haskell types and typeclasses. In this chapter, we’ll learn how to make our own and how to put them to work!</p>
3636
<h2 id="algebraic-data-types">Algebraic data types intro</h2>
3737
<p>So far, we’ve run into a lot of data types. <span class="fixed">Bool</span>, <span class="fixed">Int</span>, <span class="fixed">Char</span>, <span class="fixed">Maybe</span>, etc. But how do we make our own? Well, one way is to use the <em>data</em> keyword to define a type. Let’s see how the <span class="fixed">Bool</span> type is defined in the standard library.</p>

0 commit comments

Comments
 (0)