You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source_md/for-a-few-monads-more.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -529,7 +529,7 @@ fromDiffList (DiffList f) = f []
529
529
To make a normal list into a difference list we just do what we did before and make it a function that prepends it to another list.
530
530
Because a difference list is a function that prepends something to another list, if we just want that something, we apply the function to an empty list!
Copy file name to clipboardExpand all lines: source_md/functors-applicative-functors-and-monoids.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1549,7 +1549,7 @@ Haskell doesn't enforce these laws, so we as the programmer have to be careful t
1549
1549
1550
1550
Yes, lists are monoids!
1551
1551
Like we've seen, the `++` function and the empty list `[]` form a monoid.
1552
-
The instance is very simple:
1552
+
The instances are very simple:
1553
1553
1554
1554
```{.haskell:hs}
1555
1555
instance Semigroup [a] where
@@ -1640,7 +1640,7 @@ newtype Product a = Product { getProduct :: a }
1640
1640
```
1641
1641
1642
1642
Simple, just a `newtype` wrapper with one type parameter along with some derived instances.
1643
-
Its instance for `Monoid`goes a little something like this:
1643
+
Its instances for `Semigroup` and `Monoid`go a little something like this:
1644
1644
1645
1645
```{.haskell:hs}
1646
1646
instance Num a => Semigroup (Product a) where
@@ -1696,7 +1696,7 @@ newtype Any = Any { getAny :: Bool }
1696
1696
deriving (Eq, Ord, Read, Show, Bounded)
1697
1697
```
1698
1698
1699
-
Its instance looks goes like so:
1699
+
Its instances look like so:
1700
1700
1701
1701
```{.haskell:hs}
1702
1702
instance Semigroup Any where
@@ -1729,7 +1729,7 @@ newtype All = All { getAll :: Bool }
1729
1729
deriving (Eq, Ord, Read, Show, Bounded)
1730
1730
```
1731
1731
1732
-
And this is the instance:
1732
+
And these are the instances:
1733
1733
1734
1734
```{.haskell:hs}
1735
1735
instance Semigroup All where
@@ -1876,7 +1876,7 @@ Let's take a look at the various ways that `Maybe a` can be made an instance of
1876
1876
1877
1877
One way is to treat `Maybe a` as a monoid only if its type parameter `a` is a semigroup (or even a monoid) and then implement `<>` in such a way that it uses the `<>` operation of the values that are wrapped with `Just`.
1878
1878
We use `Nothing` as the identity, and so if one of the two values that we're `<>`ing is `Nothing`, we keep the other value.
1879
-
Here's the instance declaration:
1879
+
Here are the instance declarations:
1880
1880
1881
1881
```{.haskell:hs}
1882
1882
instance Semigroup a => Semigroup (Maybe a) where
@@ -1918,7 +1918,7 @@ newtype First a = First { getFirst :: Maybe a }
1918
1918
```
1919
1919
1920
1920
We take a `Maybe a` and we wrap it with a `newtype`.
1921
-
The `Monoid`instance is as follows:
1921
+
The `Semigroup` and `Monoid`instances are as follows:
0 commit comments