Skip to content

Commit ec084ea

Browse files
author
Gregory Cox
committed
Replace single quotes with &learnyouahaskell#39; in code blocks
1 parent ea0906b commit ec084ea

12 files changed

+307
-307
lines changed

docs/a-fistful-of-monads.html

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,8 +1461,8 @@ <h2>The list monad</h2>
14611461
</p>
14621462

14631463
<pre name="code" class="haskell:hs">
1464-
ghci&gt; [1,2] &gt;&gt;= \n -&gt; ['a','b'] &gt;&gt;= \ch -&gt; return (n,ch)
1465-
[(1,'a'),(1,'b'),(2,'a'),(2,'b')]
1464+
ghci&gt; [1,2] &gt;&gt;= \n -&gt; [&#39;a&#39;,&#39;b&#39;] &gt;&gt;= \ch -&gt; return (n,ch)
1465+
[(1,&#39;a&#39;),(1,&#39;b&#39;),(2,&#39;a&#39;),(2,&#39;b&#39;)]
14661466
</pre>
14671467

14681468
<img src="assets/images/a-fistful-of-monads/concatmap.png" alt="concatmap" class="left" width="399" height="340">
@@ -1502,7 +1502,7 @@ <h2>The list monad</h2>
15021502
listOfTuples :: [(Int,Char)]
15031503
listOfTuples = do
15041504
n &lt;- [1,2]
1505-
ch &lt;- ['a','b']
1505+
ch &lt;- [&#39;a&#39;,&#39;b&#39;]
15061506
return (n,ch)
15071507
</pre>
15081508

@@ -1522,8 +1522,8 @@ <h2>The list monad</h2>
15221522
</p>
15231523

15241524
<pre name="code" class="haskell:hs">
1525-
ghci&gt; [ (n,ch) | n &lt;- [1,2], ch &lt;- ['a','b'] ]
1526-
[(1,'a'),(1,'b'),(2,'a'),(2,'b')]
1525+
ghci&gt; [ (n,ch) | n &lt;- [1,2], ch &lt;- [&#39;a&#39;,&#39;b&#39;] ]
1526+
[(1,&#39;a&#39;),(1,&#39;b&#39;),(2,&#39;a&#39;),(2,&#39;b&#39;)]
15271527
</pre>
15281528

15291529
<p>
@@ -1553,7 +1553,7 @@ <h2>The list monad</h2>
15531553
</p>
15541554

15551555
<pre name="code" class="haskell:hs">
1556-
ghci&gt; [ x | x &lt;- [1..50], '7' `elem` show x ]
1556+
ghci&gt; [ x | x &lt;- [1..50], &#39;7&#39; `elem` show x ]
15571557
[7,17,27,37,47]
15581558
</pre>
15591559

@@ -1623,7 +1623,7 @@ <h2>The list monad</h2>
16231623
</p>
16241624

16251625
<pre name="code" class="haskell:hs">
1626-
ghci&gt; [1..50] &gt;&gt;= (\x -&gt; guard ('7' `elem` show x) &gt;&gt; return x)
1626+
ghci&gt; [1..50] &gt;&gt;= (\x -&gt; guard (&#39;7&#39; `elem` show x) &gt;&gt; return x)
16271627
[7,17,27,37,47]
16281628
</pre>
16291629

@@ -1662,7 +1662,7 @@ <h2>The list monad</h2>
16621662
sevensOnly :: [Int]
16631663
sevensOnly = do
16641664
x &lt;- [1..50]
1665-
guard ('7' `elem` show x)
1665+
guard (&#39;7&#39; `elem` show x)
16661666
return x
16671667
</pre>
16681668

@@ -1673,7 +1673,7 @@ <h2>The list monad</h2>
16731673
</p>
16741674

16751675
<pre name="code" class="haskell:hs">
1676-
ghci&gt; [ x | x &lt;- [1..50], '7' `elem` show x ]
1676+
ghci&gt; [ x | x &lt;- [1..50], &#39;7&#39; `elem` show x ]
16771677
[7,17,27,37,47]
16781678
</pre>
16791679

@@ -1714,11 +1714,11 @@ <h3>A knight’s quest</h3>
17141714
<pre name="code" class="haskell:hs">
17151715
moveKnight :: KnightPos -&gt; [KnightPos]
17161716
moveKnight (c,r) = do
1717-
(c',r') &lt;- [(c+2,r-1),(c+2,r+1),(c-2,r-1),(c-2,r+1)
1717+
(c&#39;,r&#39;) &lt;- [(c+2,r-1),(c+2,r+1),(c-2,r-1),(c-2,r+1)
17181718
,(c+1,r-2),(c+1,r+2),(c-1,r-2),(c-1,r+2)
17191719
]
1720-
guard (c' `elem` [1..8] &amp;&amp; r' `elem` [1..8])
1721-
return (c',r')
1720+
guard (c&#39; `elem` [1..8] &amp;&amp; r&#39; `elem` [1..8])
1721+
return (c&#39;,r&#39;)
17221722
</pre>
17231723

17241724
<p>

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

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ <h3>The Writer type</h3>
389389
<pre name="code" class="haskell:hs">
390390
instance (Monoid w) =&gt; Monad (Writer w) where
391391
return x = Writer (x, mempty)
392-
(Writer (x,v)) &gt;&gt;= f = let (Writer (y, v')) = f x in Writer (y, v `mappend` v')
392+
(Writer (x,v)) &gt;&gt;= f = let (Writer (y, v&#39;)) = f x in Writer (y, v `mappend` v&#39;)
393393
</pre>
394394

395395

@@ -551,10 +551,10 @@ <h3>Adding logging to programs</h3>
551551

552552

553553
<pre name="code" class="haskell:hs">
554-
gcd' :: Int -&gt; Int -&gt; Int
555-
gcd' a b
554+
gcd&#39; :: Int -&gt; Int -&gt; Int
555+
gcd&#39; a b
556556
| b == 0 = a
557-
| otherwise = gcd' b (a `mod` b)
557+
| otherwise = gcd&#39; b (a `mod` b)
558558
</pre>
559559

560560
<p>
@@ -572,7 +572,7 @@ <h3>Adding logging to programs</h3>
572572
</p>
573573

574574
<pre name="code" class="haskell:hs">
575-
ghci&gt; gcd' 8 3
575+
ghci&gt; gcd&#39; 8 3
576576
1
577577
</pre>
578578

@@ -584,7 +584,7 @@ <h3>Adding logging to programs</h3>
584584
</p>
585585

586586
<pre name="code" class="haskell:hs">
587-
gcd' :: Int -&gt; Int -&gt; Writer [String] Int
587+
gcd&#39; :: Int -&gt; Int -&gt; Writer [String] Int
588588
</pre>
589589

590590
<p>
@@ -594,14 +594,14 @@ <h3>Adding logging to programs</h3>
594594
<pre name="code" class="haskell:hs">
595595
import Control.Monad.Writer
596596

597-
gcd' :: Int -&gt; Int -&gt; Writer [String] Int
598-
gcd' a b
597+
gcd&#39; :: Int -&gt; Int -&gt; Writer [String] Int
598+
gcd&#39; a b
599599
| b == 0 = do
600600
tell ["Finished with " ++ show a]
601601
return a
602602
| otherwise = do
603603
tell [show a ++ " mod " ++ show b ++ " = " ++ show (a `mod` b)]
604-
gcd' b (a `mod` b)
604+
gcd&#39; b (a `mod` b)
605605
</pre>
606606

607607
<p>
@@ -648,7 +648,7 @@ <h3>Adding logging to programs</h3>
648648
</p>
649649

650650
<pre name="code" class="haskell:hs">
651-
ghci&gt; fst $ runWriter (gcd' 8 3)
651+
ghci&gt; fst $ runWriter (gcd&#39; 8 3)
652652
1
653653
</pre>
654654

@@ -658,7 +658,7 @@ <h3>Adding logging to programs</h3>
658658
</p>
659659

660660
<pre name="code" class="haskell:hs">
661-
ghci&gt; mapM_ putStrLn $ snd $ runWriter (gcd' 8 3)
661+
ghci&gt; mapM_ putStrLn $ snd $ runWriter (gcd&#39; 8 3)
662662
8 mod 3 = 2
663663
3 mod 2 = 1
664664
2 mod 1 = 0
@@ -861,13 +861,13 @@ <h3>Difference lists</h3>
861861
<pre name="code" class="haskell:hs">
862862
import Control.Monad.Writer
863863

864-
gcd' :: Int -&gt; Int -&gt; Writer (DiffList String) Int
865-
gcd' a b
864+
gcd&#39; :: Int -&gt; Int -&gt; Writer (DiffList String) Int
865+
gcd&#39; a b
866866
| b == 0 = do
867867
tell (toDiffList ["Finished with " ++ show a])
868868
return a
869869
| otherwise = do
870-
result &lt;- gcd' b (a `mod` b)
870+
result &lt;- gcd&#39; b (a `mod` b)
871871
tell (toDiffList [show a ++ " mod " ++ show b ++ " = " ++ show (a `mod` b)])
872872
return result
873873
</pre>
@@ -1162,8 +1162,8 @@ <h2>Tasteful stateful computations</h2>
11621162
threeCoins :: StdGen -&gt; (Bool, Bool, Bool)
11631163
threeCoins gen =
11641164
let (firstCoin, newGen) = random gen
1165-
(secondCoin, newGen') = random newGen
1166-
(thirdCoin, newGen'') = random newGen'
1165+
(secondCoin, newGen&#39;) = random newGen
1166+
(thirdCoin, newGen&#39;&#39;) = random newGen&#39;
11671167
in (firstCoin, secondCoin, thirdCoin)
11681168
</pre>
11691169

@@ -1769,9 +1769,9 @@ <h2>Error error on the wall</h2>
17691769
ghci&gt; Right 3 &gt;&gt;= \x -&gt; return (x + 100)
17701770

17711771
&lt;interactive&gt;:1:0:
1772-
Ambiguous type variable `a' in the constraints:
1773-
`Error a' arising from a use of `it' at &lt;interactive&gt;:1:0-33
1774-
`Show a' arising from a use of `print' at &lt;interactive&gt;:1:0-33
1772+
Ambiguous type variable `a&#39; in the constraints:
1773+
`Error a&#39; arising from a use of `it&#39; at &lt;interactive&gt;:1:0-33
1774+
`Show a&#39; arising from a use of `print&#39; at &lt;interactive&gt;:1:0-33
17751775
Probable fix: add a type signature that fixes these type variable(s)
17761776
</pre>
17771777

@@ -2946,8 +2946,8 @@ <h2>Making monads</h2>
29462946
<pre name="code" class="haskell:hs">
29472947
thisSituation :: Prob (Prob Char)
29482948
thisSituation = Prob
2949-
[( Prob [('a',1%2),('b',1%2)] , 1%4 )
2950-
,( Prob [('c',1%2),('d',1%2)] , 3%4)
2949+
[( Prob [(&#39;a&#39;,1%2),(&#39;b&#39;,1%2)] , 1%4 )
2950+
,( Prob [(&#39;c&#39;,1%2),(&#39;d&#39;,1%2)] , 3%4)
29512951
]
29522952
</pre>
29532953

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ <h1>Functors, Applicative Functors and Monoids</h1>
5555
</p><p>We can play around with it to gain some intuition. It’s pretty simple really. Check out this piece of code:</p>
5656
<pre name="code" class="haskell:hs">
5757
main = do line &lt;- getLine
58-
let line' = reverse line
59-
putStrLn $ "You said " ++ line' ++ " backwards!"
60-
putStrLn $ "Yes, you really said" ++ line' ++ " backwards!"
58+
let line&#39; = reverse line
59+
putStrLn $ "You said " ++ line&#39; ++ " backwards!"
60+
putStrLn $ "Yes, you really said" ++ line&#39; ++ " backwards!"
6161
</pre>
6262
<p>The user is prompted for a line and we give it back to the user, only reversed. Here’s how to rewrite this by using <span class="fixed">fmap</span>:</p>
6363
<pre name="code" class="haskell:hs">
@@ -74,7 +74,7 @@ <h1>Functors, Applicative Functors and Monoids</h1>
7474
import Data.Char
7575
import Data.List
7676

77-
main = do line &lt;- fmap (intersperse '-' . reverse . map toUpper) getLine
77+
main = do line &lt;- fmap (intersperse &#39;-&#39; . reverse . map toUpper) getLine
7878
putStrLn line
7979
</pre>
8080
<pre name="code" class="plain">
@@ -225,8 +225,8 @@ <h1>Functors, Applicative Functors and Monoids</h1>
225225
<pre name="code" class="haskell:hs">
226226
ghci&gt; :t fmap (++) (Just "hey")
227227
fmap (++) (Just "hey") :: Maybe ([Char] -&gt; [Char])
228-
ghci&gt; :t fmap compare (Just 'a')
229-
fmap compare (Just 'a') :: Maybe (Char -&gt; Ordering)
228+
ghci&gt; :t fmap compare (Just &#39;a&#39;)
229+
fmap compare (Just &#39;a&#39;) :: Maybe (Char -&gt; Ordering)
230230
ghci&gt; :t fmap compare "A LIST OF CHARS"
231231
fmap compare "A LIST OF CHARS" :: [Char -&gt; Ordering]
232232
ghci&gt; :t fmap (\x y z -&gt; x + y / z) [3,4,5,6]
@@ -444,7 +444,7 @@ <h1>Functors, Applicative Functors and Monoids</h1>
444444
ghci&gt; getZipList $ max &lt;$&gt; ZipList [1,2,3,4,5,3] &lt;*&gt; ZipList [5,3,1,2]
445445
[5,3,3,4]
446446
ghci&gt; getZipList $ (,,) &lt;$&gt; ZipList "dog" &lt;*&gt; ZipList "cat" &lt;*&gt; ZipList "rat"
447-
[('d','c','r'),('o','a','a'),('g','t','t')]
447+
[(&#39;d&#39;,&#39;c&#39;,&#39;r&#39;),(&#39;o&#39;,&#39;a&#39;,&#39;a&#39;),(&#39;g&#39;,&#39;t&#39;,&#39;t&#39;)]
448448
</pre>
449449
<div class="hintbox">The <span class="fixed">(,,)</span> function is the same as <span class="fixed">\x y z -&gt; (x,y,z)</span>. Also, the <span class="fixed">(,)</span> function is the same as <span class="fixed">\x y -&gt; (x,y)</span>.</div>
450450
<p>Aside from <span class="fixed">zipWith</span>, the standard library has functions such as <span class="fixed">zipWith3</span>, <span class="fixed">zipWith4</span>, all the way up to 7. <span class="fixed">zipWith</span> takes a function that takes two parameters and zips two lists with it. <span class="fixed">zipWith3</span> takes a function that takes three parameters and zips three lists with it, and so on. By using zip lists with an applicative style, we don’t have to have a separate zip function for each number of lists that we want to zip together. We just use the applicative style to zip together an arbitrary amount of lists with a function, and that’s pretty cool.</p>
@@ -1832,12 +1832,12 @@ <h3><span class="fixed">Maybe</span> the monoid</h3>
18321832
</p>
18331833

18341834
<pre name="code" class="haskell:hs">
1835-
ghci&gt; getFirst $ First (Just 'a') `mappend` First (Just 'b')
1836-
Just 'a'
1837-
ghci&gt; getFirst $ First Nothing `mappend` First (Just 'b')
1838-
Just 'b'
1839-
ghci&gt; getFirst $ First (Just 'a') `mappend` First Nothing
1840-
Just 'a'
1835+
ghci&gt; getFirst $ First (Just &#39;a&#39;) `mappend` First (Just &#39;b&#39;)
1836+
Just &#39;a&#39;
1837+
ghci&gt; getFirst $ First Nothing `mappend` First (Just &#39;b&#39;)
1838+
Just &#39;b&#39;
1839+
ghci&gt; getFirst $ First (Just &#39;a&#39;) `mappend` First Nothing
1840+
Just &#39;a&#39;
18411841
</pre>
18421842

18431843
<p>

0 commit comments

Comments
 (0)