|
33 | 33 | </div> |
34 | 34 | <h1 id="for-a-few-monads-more">For a Few Monads More</h1> |
35 | 35 |
|
36 | | -<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"> |
| 36 | +<img src="assets/images/for-a-few-monads-more/clint.png" class="right" width="189" height="400" 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"> |
37 | 37 |
|
38 | 38 | <p> |
39 | 39 | We’ve seen how monads can be used to take values with contexts and apply them to |
@@ -124,7 +124,7 @@ <h2 id="writer">Writer? I hardly know her!</h2> |
124 | 124 | (True,"Compared gang size to 9.") |
125 | 125 | </pre> |
126 | 126 |
|
127 | | -<img src="assets/images/for-a-few-monads-more/tuco.png" alt="when you have to poop, poop, don’t talk" class="left" width="196" height="280"> |
| 127 | +<img src="assets/images/for-a-few-monads-more/tuco.png" class="left" width="196" height="280" alt="when you have to poop, poop, don’t talk"> |
128 | 128 |
|
129 | 129 | <p> |
130 | 130 | So far so good. <span class="fixed">isBigGang</span> takes a normal value and |
@@ -394,7 +394,7 @@ <h3 id="the-writer-type">The Writer type</h3> |
394 | 394 | </pre> |
395 | 395 |
|
396 | 396 |
|
397 | | -<img src="assets/images/for-a-few-monads-more/angeleyes.png" alt="when you have to poop, poop, don’t talk" class="right" width="383" height="248"> |
| 397 | +<img src="assets/images/for-a-few-monads-more/angeleyes.png" class="right" width="383" height="248" alt="when you have to poop, poop, don’t talk"> |
398 | 398 | <p> |
399 | 399 | First off, let’s examine <span class="fixed">>>=</span>. Its |
400 | 400 | implementation is essentially the same as <span class="fixed">applyLog</span>, |
@@ -756,7 +756,7 @@ <h3 id="inefficient-list-construction">Inefficient list construction</h3> |
756 | 756 |
|
757 | 757 | <h3 id="difference-lists">Difference lists</h3> |
758 | 758 |
|
759 | | -<img src="assets/images/for-a-few-monads-more/cactus.png" alt="cactuses" class="left" width="147" height="300"> |
| 759 | +<img src="assets/images/for-a-few-monads-more/cactus.png" class="left" width="147" height="300" alt="cactuses"> |
760 | 760 |
|
761 | 761 | <p> |
762 | 762 | Because lists can sometimes be inefficient when repeatedly appended in this |
@@ -976,7 +976,7 @@ <h3 id="comparing-performance">Comparing Performance</h3> |
976 | 976 |
|
977 | 977 | <h2 id="reader">Reader? Ugh, not this joke again.</h2> |
978 | 978 |
|
979 | | -<img src="assets/images/for-a-few-monads-more/revolver.png" alt="bang youre dead" class="left" width="280" height="106"> |
| 979 | +<img src="assets/images/for-a-few-monads-more/revolver.png" class="left" width="280" height="106" alt="bang youre dead"> |
980 | 980 |
|
981 | 981 | <p> |
982 | 982 | In the <a href="functors-applicative-functors-and-monoids.html">chapter about |
@@ -1136,7 +1136,7 @@ <h2 id="reader">Reader? Ugh, not this joke again.</h2> |
1136 | 1136 |
|
1137 | 1137 |
|
1138 | 1138 | <h2 id="state">Tasteful stateful computations</h2> |
1139 | | -<img src="assets/images/for-a-few-monads-more/texas.png" alt="don’t jest with texas" class="left" width="244" height="230"> |
| 1139 | +<img src="assets/images/for-a-few-monads-more/texas.png" class="left" width="244" height="230" alt="don’t jest with texas"> |
1140 | 1140 |
|
1141 | 1141 | <p> |
1142 | 1142 | Haskell is a pure language and because of that, our programs are made of |
@@ -1366,7 +1366,7 @@ <h3 id="the-state-monad">The State monad</h3> |
1366 | 1366 | a certain value as the result and keeps the state unchanged. |
1367 | 1367 | </p> |
1368 | 1368 |
|
1369 | | -<img src="assets/images/for-a-few-monads-more/badge.png" alt="im a cop" class="right" width="182" height="160"> |
| 1369 | +<img src="assets/images/for-a-few-monads-more/badge.png" class="right" width="182" height="160" alt="im a cop"> |
1370 | 1370 |
|
1371 | 1371 | <p> |
1372 | 1372 | What about <span class="fixed">>>=</span>? Well, the result of feeding a |
@@ -1821,7 +1821,7 @@ <h2 id="useful-monadic-functions">Some useful monadic functions</h2> |
1821 | 1821 |
|
1822 | 1822 | <h3 id="liftm-and-friends">liftM and friends</h3> |
1823 | 1823 |
|
1824 | | -<img src="assets/images/for-a-few-monads-more/wolf.png" alt="im a cop too" class="right" width="394" height="222"> |
| 1824 | +<img src="assets/images/for-a-few-monads-more/wolf.png" class="right" width="394" height="222" alt="im a cop too"> |
1825 | 1825 |
|
1826 | 1826 | <p> |
1827 | 1827 | When we started our journey to the top of Monad Mountain, we first looked |
@@ -2184,7 +2184,7 @@ <h3 id="the-join-function">The join function</h3> |
2184 | 2184 | m |
2185 | 2185 | </pre> |
2186 | 2186 |
|
2187 | | -<img src="assets/images/for-a-few-monads-more/tipi.png" alt="im a cop too as well also" class="right" width="253" height="379"> |
| 2187 | +<img src="assets/images/for-a-few-monads-more/tipi.png" class="right" width="253" height="379" alt="im a cop too as well also"> |
2188 | 2188 |
|
2189 | 2189 | <p> |
2190 | 2190 | Perhaps the most interesting thing about <span class="fixed">join</span> is |
@@ -2468,7 +2468,7 @@ <h3 id="foldm">foldM</h3> |
2468 | 2468 |
|
2469 | 2469 | <h3 id="making-a-safe-rpn-calculator">Making a safe RPN calculator</h3> |
2470 | 2470 |
|
2471 | | -<img src="assets/images/for-a-few-monads-more/miner.png" alt="i’ve found yellow!" class="left" width="280" height="396"> |
| 2471 | +<img src="assets/images/for-a-few-monads-more/miner.png" class="left" width="280" height="396" alt="i’ve found yellow!"> |
2472 | 2472 |
|
2473 | 2473 | <p> |
2474 | 2474 | When we were solving the problem of <a href="http://learnyouahaskell.com/reverse-polish-notation-calculator">implementing a RPN calculator</a>, |
@@ -2771,7 +2771,7 @@ <h3 id="composing-monadic-functions">Composing monadic functions</h3> |
2771 | 2771 |
|
2772 | 2772 |
|
2773 | 2773 | <h2 id="making-monads">Making monads</h2> |
2774 | | -<img src="assets/images/for-a-few-monads-more/spearhead.png" alt="kewl" class="center" width="780" height="244"> |
| 2774 | +<img src="assets/images/for-a-few-monads-more/spearhead.png" class="center" width="780" height="244" alt="kewl"> |
2775 | 2775 |
|
2776 | 2776 | <p> |
2777 | 2777 | In this section, we’re going to look at an example of how a type gets made, |
@@ -2926,7 +2926,7 @@ <h2 id="making-monads">Making monads</h2> |
2926 | 2926 | models this scenario: |
2927 | 2927 | </p> |
2928 | 2928 |
|
2929 | | -<img src="assets/images/for-a-few-monads-more/prob.png" alt="probs" class="left" width="456" height="142"> |
| 2929 | +<img src="assets/images/for-a-few-monads-more/prob.png" class="left" width="456" height="142" alt="probs"> |
2930 | 2930 |
|
2931 | 2931 | <p> |
2932 | 2932 | What are the chances for each of these letters to occur? If we were to draw this |
@@ -2989,7 +2989,7 @@ <h2 id="making-monads">Making monads</h2> |
2989 | 2989 | fail _ = Prob [] |
2990 | 2990 | </pre> |
2991 | 2991 |
|
2992 | | -<img src="assets/images/for-a-few-monads-more/ride.png" alt="ride em cowboy" class="right" width="177" height="406"> |
| 2992 | +<img src="assets/images/for-a-few-monads-more/ride.png" class="right" width="177" height="406" alt="ride em cowboy"> |
2993 | 2993 |
|
2994 | 2994 | <p> |
2995 | 2995 | Because we already did all the hard work, the instance is very simple. We also |
|
0 commit comments